[GRASS-user] python parse_command
Jonathan Reith
reith at mundialis.de
Mon Feb 12 00:14:42 PST 2018
Dear list,
I am struggling with my python code.
I am trying to get the computational region of a xyz-file. If I use
r.in.xyz in GRASS itself, it works all just fine, but using it in python
I always get an error.
Here is my code:
from grass_session import Session
from grass.script import core as gcore
from grass.pygrass.modules.shortcuts import general as g
from grass.pygrass.modules.shortcuts import raster as r
with Session(gisdb="/home/jreith/grassdata",
location="nrw",mapset="elevation", create_opts="EPSG:4326"):
compregion = gcore.parse_command('r.in_xyz',
input="/geodaten/dgm1.xyz", flags='s',
output="new_file",separator='space')
The error:
Traceback (most recent call last):
File "grass_scripts/grass_dem.py", line 32, in <module>
compregion = gcore.parse_command('r.in_xyz',
input="/geodaten/dgm1.xyz", flags='s',
output="new_file",separator='space')
File
"/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 516, in parse_command
res = read_command(*args, **kwargs)
File
"/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 471, in read_command
process = pipe_command(*args, **kwargs)
File
"/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 444, in pipe_command
return start_command(*args, **kwargs)
File
"/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 380, in start_command
return Popen(args, **popts)
File
"/home/jreith/source/grass-7.4.svn/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 74, in __init__
subprocess.Popen.__init__(self, args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I appreciate any help and hope I made myself clear.
best regards
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180212/8a3bb049/attachment.html>
More information about the grass-user
mailing list