[GRASS-user] Problems with r.in.gdal and python

Johannes Radinger johannesradinger at gmail.com
Wed Nov 28 04:17:56 PST 2012


Hi,

I try to load several maps from a geoTiff into GRASS via a python script.
Although it is working with a bash-command, it isn't with the python
command I am using:

# Bash command way
r.in.gdal --overwrite input=path/to/map.tif output=test

# python approach
testmap = "path/to/map.tif"
grass.run_command("r.in gdal", overwrite = True, input = testmap,
output = "test")

The error I get is:
grass.run_command("r.in gdal", overwrite = True, input = testmap,
output = "test")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/grass-6.5.svn/etc/python/grass/script/core.py",
line 189, in run_command
    ps = start_command(*args, **kwargs)
  File "/usr/local/grass-6.5.svn/etc/python/grass/script/core.py",
line 177, in start_command
    return Popen(args, **popts)
  File "/usr/local/grass-6.5.svn/etc/python/grass/script/core.py",
line 56, in __init__
    startupinfo, creationflags)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

What I am doing wrong? Maybe it is just a little thing I am missing...

I am working on Ubuntu 12.04 with GRASS 6.5 (most recent version r54086) and
Python 2.7.3.

Any help appreciated. Thanks in advance.


/Johannes


More information about the grass-user mailing list