On 14/11/14 10:25, Helmut Kudrnovsky wrote:
Anna Petrášová wrote
but in --quiet mode it fails with:
v.fixed.segmentpoints --quiet vector=iselflipped@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?
Could you try to print tmp with and without quiet?
http://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.fixed.segmentpoints/v.fixed.segmentpoints.py#L102
102 # Read length
103 tmp = grass.read_command('v.to.db', map = voutline,
104 type = 'line',
105 layer = 1,
106 qlayer = 1,
107 option = 'length',
108 units = 'meters',
109 column = 'vlength',
110 flags = 'p')
111 vector_line_length = float(tmp.split('\n')[1].split('|')[1])
112
113 # Print vector line length
114 grass.message( "Vector line length in meter:" )
115 grass.message( vector_line_length )
116 grass.message( "----" )
it's just to get the length of the vector line for further calculations:
in normal and verbose mode:
----
Lese Objekte...
Vector line length in meter:
58858.3366368
----
as Moritz points out, it seems quiet mode suppresses the access to the
output of grass.read_command; his solution/workaround with GRASS_VERBOSE env
variable seems not to work here on my side.
I'm afraid that --quiet supersedes any settings in the code, but am not
sure.
Moritz
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev