-1

我正在尝试在 Eclipse 中编写草脚本,并按照页面中概述的说明进行操作。我想我已经配置了所有东西,但是当我尝试导入 Grass.script 时,我收到以下消息:

Traceback (most recent call last):
  File "/home/nesic/Desktop/grass_dev/Simulacije/test.py", line 6, in <module>
    import grass.script as grass
  File "/usr/lib/grass64/etc/python/grass/script/__init__.py", line 1, in <module>
    from core   import *
  File "/usr/lib/grass64/etc/python/grass/script/core.py", line 38, in <module>
    gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
  File "/usr/local/lib/python2.6/posixpath.py", line 67, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

我究竟做错了什么?

4

1 回答 1

0

os.getenv("GISBASE")最有可能返回,因为未设置None环境变量。GISBASE然后导致AttributeError: 'NoneType' object has no attribute 'endswith'你看到的。

尝试GISBASE根据http://grass.osgeo.org/grass70/manuals/variables.html设置:

地理信息系统数据库

directory where GRASS lives. This is set automatically by the startup script.

(顺便说一句,如果你还不知道,还有gis.stackexchange.org

于 2013-10-16T13:05:02.093 回答