[GRASS-dev] Python grass script error

Hi,

I have GRASS 7.3.svn (r71212). In python , calling grass.script I get:

import grass.script as grass
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/grass-7.3.svn/etc/python/grass/script/init.py”, line 5, in
from .core import *
File “/usr/local/grass-7.3.svn/etc/python/grass/script/core.py”, line 35, in
gettext.install(‘grasslibs’, os.path.join(os.getenv(“GISBASE”), ‘locale’))
File “/usr/lib64/python2.7/posixpath.py”, line 70, in join
elif path == ‘’ or path.endswith(‘/’):
AttributeError: ‘NoneType’ object has no attribute ‘endswith’

Anyone can reproduce this error?

Thank you in advance

···

Margherita Di Leo

Works just fine here.
What is the output of os.getenv("GISBASE")? Are you trying to run this
code outside of GRASS GIS session (this could explain lack of GISBASE
environmental setting)?

Māris.

2017-06-29 18:00 GMT+03:00 Margherita Di Leo <diregola@gmail.com>:

Hi,

I have GRASS 7.3.svn (r71212). In python , calling grass.script I get:

import grass.script as grass

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/grass-7.3.svn/etc/python/grass/script/__init__.py", line
5, in <module>
    from .core import *
  File "/usr/local/grass-7.3.svn/etc/python/grass/script/core.py", line 35,
in <module>
    gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"),
'locale'))
  File "/usr/lib64/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Anyone can reproduce this error?

Thank you in advance

--
Margherita Di Leo

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Maris, thank you for checking this!! Was my mistake, I hadn’t noticed that I had a duplication of import grass.script as grass, the one throwing the error was at the top of the script before declaring GISBASE… need holidays I guess… sorry for the noise.

···

On Fri, Jun 30, 2017 at 11:59 AM, Maris Nartiss <maris.gis@gmail.com> wrote:

Works just fine here.
What is the output of os.getenv(“GISBASE”)? Are you trying to run this
code outside of GRASS GIS session (this could explain lack of GISBASE
environmental setting)?

Māris.

2017-06-29 18:00 GMT+03:00 Margherita Di Leo <diregola@gmail.com>:

Hi,

I have GRASS 7.3.svn (r71212). In python , calling grass.script I get:

import grass.script as grass
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/grass-7.3.svn/etc/python/grass/script/init.py”, line
5, in
from .core import *
File “/usr/local/grass-7.3.svn/etc/python/grass/script/core.py”, line 35,
in
gettext.install(‘grasslibs’, os.path.join(os.getenv(“GISBASE”),
‘locale’))
File “/usr/lib64/python2.7/posixpath.py”, line 70, in join
elif path == ‘’ or path.endswith(‘/’):
AttributeError: ‘NoneType’ object has no attribute ‘endswith’

Anyone can reproduce this error?

Thank you in advance


Margherita Di Leo


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Margherita Di Leo