[GRASS-user] grass 6.4 rc5 and python scripting

Glynn Clements glynn at gclements.plus.com
Tue Jun 30 11:36:29 EDT 2009


Moritz Lennert wrote:

> > I compiled grass-6.4.0RC5 (downloaded a tarball from the main site).
> > I'd like to learn about scripting grass with python.
> > 
> > Following the first sample script at the GRASS Python scripting
> > library (http://download.osgeo.org/grass/grass6_progman/pythonlib.html)
> > I created a test file called teste.py, and placed it on the Desktop.
> > When I try to run it inside a GRASS session I am geting the following
> > error:
> > 
> > GRASS 6.4.0RC5 (aeigT3):~/Desktop > ./teste.py
> > sh: teste.py: not found
> > Traceback (most recent call last):
> >   File "/usr/local/grass-6.4.0RC5/etc/wxpython/gui_modules/menuform.py",
> > line 1931, in <module>
> >     GrassGUIApp( grassTask( sys.argv[1] ) ).MainLoop()
> >   File "/usr/local/grass-6.4.0RC5/etc/wxpython/gui_modules/menuform.py",
> > line 335, in __init__
> >     xml.sax.parseString( getInterfaceDescription( grassModule ) ,
> > processTask( self ) )
> >   File "/usr/local/grass-6.4.0RC5/etc/wxpython/gui_modules/menuform.py",
> > line 1748, in getInterfaceDescription
> >     raise IOError, _("Unable to fetch interface description for
> > command '%s'.") % cmd
> > IOError: Unable to fetch interface description for command 'teste.py'.
> > 
> > The file contents are just a copy+paste from the online example. Can
> > someone point me to the cause of the error?
> 
> In order for g.parser to work, the file teste.py needs to be in your 
> PATH.

This is actually a bug in G_parser() and G_gui(). menuform.py is being
passed the base filename rather than the complete path. There isn't
any other reason why the script needs to be in the path.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list