[GRASS-user] grass 6.4 rc5 and python scripting

Hello list

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?

Thanks in advance

--
___________________________ ___ __
Ricardo Garcia Silva

Hi,

2009/6/30 Ricardo Filipe Soares Garcia da <ricardo.garcia.silva@gmail.com>:

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:

to launch wxGUI interface you need to copy teste.py to
$GISBASE/scripts. Anyway CLI works in every case

./teste.py --help

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Thanks for your help

Now I'll get on with the program!
Hopefully I'll be able to build a "script that can find the nearest
hospital to an accident site on a vector network" working :wink:

Cheers

On Tue, Jun 30, 2009 at 2:51 PM, Martin Landa<landa.martin@gmail.com> wrote:

Hi,

2009/6/30 Ricardo Filipe Soares Garcia da <ricardo.garcia.silva@gmail.com>:

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:

to launch wxGUI interface you need to copy teste.py to
$GISBASE/scripts. Anyway CLI works in every case

./teste.py --help

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

--
___________________________ ___ __
Ricardo Garcia Silva

Please help: What could be missing?

Compiling on ubuntu 9.04 64bit (linux mint)

Errors in:
/usr/local/src/grass6_devel/lib/db/sqlp
/usr/local/src/grass6_devel/db/drivers/ogr
/usr/local/src/grass6_devel/db/drivers/dbf
/usr/local/src/grass6_devel/raster/r.mapcalc

Thanks a lot!
Achim

with:
CFLAGS="-O3 -msse3 -march=core2 -Wall" LDFLAGS="-s" ./configure \
       --enable-64bit \
       --with-libs=/usr/lib64 \
       --with-fftw \
       --with-cxx \
       --with-sqlite \
       --with-cairo \
       --with-cairo-includes=/usr/include/cairo \
       --with-freetype \
       --with-freetype-includes=/usr/include/freetype2 \
       --with-proj-share=/usr/share/proj \
       --with-geos \
       --with-python=/usr/bin/python2.6-config \
       --with-wxwidgets=/usr/bin/wx-config \
       --with-tcltk-includes=/usr/include/tcl8.5 \
       --with-readline

GRASS is now configured for: x86_64-unknown-linux-gnu

  Source directory: /usr/local/src/grass6_devel
  Build directory: /usr/local/src/grass6_devel
  Installation directory: ${prefix}/grass-6.5.svn
  Startup script in directory: ${exec_prefix}/bin
  C compiler: gcc -O3 -msse3 -march=core2 -Wall C++ compiler: c++ -g -O2
  Building shared libraries: yes
  64bit support: yes
  OpenGL platform: X11

  MacOSX application: no

  NVIZ: yes

  BLAS support: no
  C++ support: yes
  Cairo support: yes
  DWG support: no
  FFMPEG support: no
  FFTW support: yes
  FreeType support: yes
  GDAL support: yes
  GEOS support: yes
  GLw support: no
  JPEG support: yes
  LAPACK support: no
  Large File support (LFS): yes
  Motif support: no
  MySQL support: no
  NLS support: no
  ODBC support: no
  OGR support: yes
  OpenGL support: yes
  PNG support: yes
  PostgreSQL support: no
  Python support: yes
  Readline support: yes
  SQLite support: yes
  Tcl/Tk support: yes
  wxWidgets support: yes
  TIFF support: yes
  X11 support: yes

Errors in:
/usr/local/src/grass6_devel/lib/db/sqlp
/usr/local/src/grass6_devel/db/drivers/ogr
/usr/local/src/grass6_devel/db/drivers/dbf
/usr/local/src/grass6_devel/raster/r.mapcalc

On 30/06/09 12:58, Ricardo Filipe Soares Garcia da wrote:

Hello list

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. So, you can do something like this:

export PATH=$PATH:.
./teste.py

Moritz

Hi,

2009/6/30 achim <ak7@jupiter.uni-freiburg.de>:

[...]

Errors in:
/usr/local/src/grass6_devel/lib/db/sqlp
/usr/local/src/grass6_devel/db/drivers/ogr
/usr/local/src/grass6_devel/db/drivers/dbf
/usr/local/src/grass6_devel/raster/r.mapcalc

you have to send error log from 'lib/db/sqlp', otherwise nobody can help you.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

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@gclements.plus.com>