[GRASS-dev] [GRASS GIS] #2138: winGRASS6.4.svn - addon python script status?

GRASS GIS trac at osgeo.org
Sun Nov 24 07:24:29 PST 2013


#2138: winGRASS6.4.svn - addon python script status?
-------------------------------------+--------------------------------------
 Reporter:  hellik                   |       Owner:  grass-dev@…              
     Type:  defect                   |      Status:  new                      
 Priority:  blocker                  |   Milestone:  6.4.4                    
Component:  Addons                   |     Version:  unspecified              
 Keywords:  wingrass, addon, python  |    Platform:  MSWindows 7              
      Cpu:  x86-64                   |  
-------------------------------------+--------------------------------------
 regarding 6.4.4 planning
 http://lists.osgeo.org/pipermail/grass-dev/2013-November/066351.html

 some tests for addon python scripts:

 {{{
 System Info
 GRASS Version: 6.4.4svn
 GRASS SVN Revision: 58275
 GIS Library Revision: 50937 (2012-02-25)
 GDAL/OGR: 1.10.1
 PROJ4: Rel. 4.8.0, 6 March 2012
 Python: 2.7.4
 wxPython: 2.8.12.1
 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
 }}}

 structure of the addon-folder in winGRASS6.4.svn:

 {{{
 bin <= python script related bat-files are here
 docs
 man
 modules.xml
 r.basin.py
 r.ipso.py
 r.stream.angle.exe
 r.stream.basins.exe
 r.stream.del.exe
 r.stream.distance.exe
 r.stream.extract.exe
 r.stream.order.exe
 r.stream.pos.exe
 r.stream.stats.exe
 r.wf.py
 }}}


 the python script related bat-files are here are in the bin-folder, but
 the addon\bin isn't in the %GRASS_ADDON_PATH%

 the content of r.basin.py.bat:

 {{{
 @"%GRASS_SH%" "%GISBASE%/scripts/r.basin.py" %*
 }}}

 %GRASS_SH% can't start python scripts.


 so python script aren't working with winGRASS6.4.SVN

 now testing with winGRASS6.5.svn

 {{{
 System Info
 GRASS Version: 6.5.svn
 GRASS SVN Revision: 58286
 GIS Library Revision: 50936 (2012-02-25)
 GDAL/OGR: 1.10.1
 PROJ4: Rel. 4.8.0, 6 March 2012
 Python: 2.7.4
 wxPython: 2.8.12.1
 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
 }}}

 Fetch & install extension from GRASS Addons

 structure of the addon-folder in winGRASS6.5.svn:

 {{{
 bin <= empty
 docs
 etc
 man
 modules.xml
 r.basin.bat <=
 r.basin.py <=
 r.ipso.bat
 r.ipso.py
 r.stream.angle.exe
 r.stream.basins.exe
 r.stream.del.exe
 r.stream.distance.exe
 r.stream.extract.exe
 r.stream.order.exe
 r.stream.pos.exe
 r.stream.preview.bat
 r.stream.preview.py
 r.stream.stats.exe
 r.wf.bat
 r.wf.py
 scripts
 }}}

 in the wxgui-commandline r.basin can be choosen, but

 {{{
 Traceback (most recent call last):
   File "C:\OSGEO4~1\apps\grass\grass-6.5.svn\etc\wxpython\gu
 i_core\prompt.py", line 839, in OnItemSelected

 self.cmdDesc = gtask.parse_interface(GetRealCmd(cmd))
   File "C:\OSGEO4~1\apps\grass\grass-6.5.svn\etc\python\gras
 s\script\task.py", line 470, in parse_interface

 tree = etree.fromstring(get_interface_description(name))
   File "C:\OSGEO4~1\apps\grass\grass-6.5.svn\etc\python\gras
 s\script\task.py", line 448, in get_interface_description

 "\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' :
 decode(cmderr) }
 grass.script.core
 .
 ScriptError
 :
 Unable to fetch interface description for command
 'r.basin.bat'.
 Details: C:\OSGEO4~1\bin\python.exe: can't open file
 'C:/OSGEO4~1/apps/grass/grass-6.5.svn/r.basin.py': [Errno 2]
 No such file or directory
 }}}

 content of r.basin.bat:

 {{{
 @"%GRASS_PYTHON%" "%GISBASE%/r.basin.py" %*
 }}}

 addon-path isn't within the related bat-file, it searches in %GISBASE%

 with following changes

 {{{
 r.basin.bat
 @"%GRASS_PYTHON%" "%GRASS_ADDON_PATH%/r.basin.py" %*
 }}}

 r.basin-gui can be invoked, but running the script by 'run' in the r
 .basin-wxgui raises following error

 {{{
 r.basin.py --verbose map=elevation at PERMANENT prefix=oh
 easting=636654.791181 northing=218824.126649 threshold=20
 C:\OSGEO4~1\bin\python.exe: can't open file 'r.basin.py':
 [Errno 2] No such file or directory
 (Sun Nov 24 15:47:59 2013) Befehl ausgeführt (0 Sek)
 }}}

 but starting within the wxgui-commandline

 {{{
 r.basin --verbose map=elevation at PERMANENT prefix=oh easting=636654.791181
 northing=218824.126649 threshold=20
 ABSCHNITT 1a (von 4): Initiiere den Speicher.
 ABSCHNITT 1b (of 4): Ermittle den Fluß aus der Karte heraus.
 ABSCHNITT 2: A * Suche.
 [...]
 }}}

 the script (which invokes two other python scripts) finishes now.

 the '''winGRASS6.5.svn-approach/status''' regarding python addon-scripts
 is '''much better''' than winGRASS6.4.svn-approach/status

 what is missing for downgrading ticket?

 - change in the bat-file for the python script '''%GISBASE%'''/xyz.py to
 '''%GRASS_ADDON_PATH%'''/xyz.py

 - run the script by the run-button in the script-wxgui should work

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2138>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list