[GRASS-dev] grass7 addon python script - finishes in normal and --verbose mode, but not in --quiet mode

Moritz Lennert mlennert at club.worldonline.be
Fri Nov 14 00:46:27 PST 2014


On 13/11/14 21:44, Helmut Kudrnovsky wrote:
> tested here with:
>
> GRASS Version: 7.1.svn
> GRASS SVN Revision: 62712
> Erstellungsdatum: 2014-11-12
> Build Platform: i686-pc-mingw32
> GDAL/OGR: 1.11.0
> PROJ.4: 4.8.0
> GEOS: 3.4.2
> SQLite: 3.7.17
> Python: 2.7.4
> wxPython: 2.8.12.1
> Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
>
> running the addon script [1] in normal and --verbose mode:
>
> v.fixed.segmentpoints vector=iselflipped at myricaria cat=1
> dir=C:\tmp\grassscript distance=25000
> Extract vector line for which segment points should be calculated ...
> [...]
> ----
> v.fixed.segmentpoints done!
> (Thu Nov 13 21:36:52 2014) Befehl ausgeführt (43 Sek)
>
> v.fixed.segmentpoints --verbose vector=iselflipped at myricaria cat=1
> dir=C:\tmp\grassscript distance=25000
> Extract vector line for which segment points should be calculated ...
> [...]
> ----
> v.fixed.segmentpoints done!
> (Thu Nov 13 21:39:03 2014) Befehl ausgeführt (35 Sek)
>
> it works.
>
> but in --quiet mode it fails with:
>
> v.fixed.segmentpoints --quiet vector=iselflipped at myricaria cat=1
> dir=C:\tmp\grassscript distance=25000
> Traceback (most recent call last):
>    File "C:\Users\myricaria\AppData\Roaming\GRASS7\addons/scr
> ipts/v.fixed.segmentpoints.py", line 226, in <module>
>      sys.exit(main())
>    File "C:\Users\myricaria\AppData\Roaming\GRASS7\addons/scr
> ipts/v.fixed.segmentpoints.py", line 100, in main
>      vector_line_length =
> float(tmp.split('\n')[1].split('|')[1])
> IndexError: list index out of range
> (Thu Nov 13 21:40:08 2014) Befehl ausgeführt (2 Sek)
>
> any idea?


I don't understand the details, but I think that --quiet somehow 
suppresses the access to the output of your 
grass.read_command('v.to.db', ...).

I've had similar issues with pipe_command for v.centerline. So I played 
with the GRASS_VERBOSE env variable. See [1].

Moritz

[1] 
http://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.centerline/v.centerline.py#L228


More information about the grass-dev mailing list