pesekon2 / grass

GRASS GIS - free and open source Geographic Information System (GIS)
https://grass.osgeo.org
Other
0 stars 0 forks source link

gsetup.init() error message not working #4

Closed pesekon2 closed 1 year ago

pesekon2 commented 1 year ago

Workflow:

import os
import sys
sys.path.append('/usr/lib/grass82/etc/python')
import tempfile
gisdb = os.path.join(tempfile.gettempdir(), 'grassdata')
import binascii
location = binascii.hexlify(os.urandom(16)).decode("utf-8")
import grass.script.setup as gsetup

GRASS 8.2:

>>> gsetup.init('/tmp', gisdb, location, 'PERMANENT')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/grass82/etc/python/grass/script/setup.py", line 326, in init
    raise ValueError(
ValueError: Mapset /tmp/grassdata/f47bfa6ac47aac36211ca8ed33f11242 is not valid: </tmp/grassdata> is not a valid GRASS Location because PERMANENT Mapset is missing

Master:

>>> gsetup.init('/home/ondrej/workspace/grass/dist.x86_64-pc-linux-gnu', gisdb, location, 'PERMANENT')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ondrej/workspace/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/script/setup.py", line 330, in init
    _("Mapset {path} is not valid: {reason}").format(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'str' object is not callable