[GRASS-dev] GRASS 7: v.net.path and xml.etree.ElementTree ParseError

Hi,

trying out v.net.path on yesterday's GRASS 7 OSGeo4W, the command runs
through properly (correct result) but raises then an error:

echo 1 1 2 | v.net.path KAnet_HbfHs alayer=1 nlayer=2 out=shortpath_dist --o
WARNING: Il vettoriale <shortpath_dist> è già presente e sarà sovrascritto
Creando il grafico...
Registrando archi...
Flattening the graph...
Il grafico è stata creato
Si sta ricreando la topologia per il vettore <shortpath_dist@KA_net>...
Registrando primitive...
1 primitive registrate
140 vertici registrati
Costruendo aree...
0 aree create
0 isole create
Isole allegate...
Centroidi allegati...
Numero di nodi: 2
Numero di primitive:1
Numero di punti:0
Numero di linee:1
Numero di confini:0
Numero di centroidi:0
Numero di aree:0
Numero di isole:0
(Thu May 23 17:47:18 2013) Command finished (0 sec)
Traceback (most recent call last):
  File "C:\OSGeo4W\apps\grass\grass-7.0.svn\etc\gui\wxpython
\core\gconsole.py", line 647, in OnCmdDone

task = GUI(show=None).ParseCommand(event.cmd)
  File "C:\OSGeo4W\apps\grass\grass-7.0.svn\etc\gui\wxpython
\gui_core\forms.py", line 2188, in ParseCommand

blackList = _blackList)
  File "C:\OSGeo4W\apps\grass\grass-7.0.svn\etc\python\grass
\script\task.py", line 487, in parse_interface

tree = etree.fromstring(get_interface_description(name))
  File
"C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",
line 1300, in XML

parser.feed(text)
  File
"C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",
line 1642, in feed

self._raiseerror(v)
  File
"C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",
line 1506, in _raiseerror

raise err
xml.etree.ElementTree
.
ParseError
:
syntax error: line 1, column 0

Citing a related older wish:

On Wed, Jan 25, 2012 at 3:58 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:

GRASS GIS wrote:

xml.etree.ElementTree
.
ParseError
:
no element found: line 1, column 0

Would someone mind fixing the code to generate a more meaningful error
message when --interface-description fails (e.g. when the resulting
string is empty or consists solely of whitespace)?

I wonder where the error comes from... happens on Linux as well. Perhaps
the pipe | is causing it?

Markus

On Thu, May 23, 2013 at 6:34 PM, Markus Neteler <neteler@osgeo.org> wrote:

Hi,

trying out v.net.path on yesterday's GRASS 7 OSGeo4W, the command runs
through properly (correct result) but raises then an error:

echo 1 1 2 | v.net.path KAnet_HbfHs alayer=1 nlayer=2 out=shortpath_dist
--o
WARNING: Il vettoriale <shortpath_dist> è già presente e sarà sovrascritto
Creando il grafico...
Registrando archi...
Flattening the graph...
Il grafico è stata creato
Si sta ricreando la topologia per il vettore <shortpath_dist@KA_net>...
Registrando primitive...
1 primitive registrate
140 vertici registrati
Costruendo aree...
0 aree create
0 isole create
Isole allegate...
Centroidi allegati...
Numero di nodi: 2
Numero di primitive:1
Numero di punti:0
Numero di linee:1
Numero di confini:0
Numero di centroidi:0
Numero di aree:0
Numero di isole:0
(Thu May 23 17:47:18 2013) Command finished (0 sec)
Traceback (most recent call last):
  File "C:\OSGeo4W\apps\grass\grass-7.0.svn\etc\gui\wxpython
\core\gconsole.py", line 647, in OnCmdDone

task = GUI(show=None).ParseCommand(event.cmd)
  File "C:\OSGeo4W\apps\grass\grass-7.0.svn\etc\gui\wxpython
\gui_core\forms.py", line 2188, in ParseCommand

blackList = _blackList)
  File "C:\OSGeo4W\apps\grass\grass-7.0.svn\etc\python\grass
\script\task.py", line 487, in parse_interface

tree = etree.fromstring(get_interface_description(name))
  File
"C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",
line 1300, in XML

parser.feed(text)
  File
"C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",
line 1642, in feed

self._raiseerror(v)
  File
"C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",
line 1506, in _raiseerror

raise err
xml.etree.ElementTree
.
ParseError
:
syntax error: line 1, column 0

Citing a related older wish:

On Wed, Jan 25, 2012 at 3:58 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:
>
> GRASS GIS wrote:
>
>> xml.etree.ElementTree
>> .
>> ParseError
>> :
>> no element found: line 1, column 0
>
> Would someone mind fixing the code to generate a more meaningful error
> message when --interface-description fails (e.g. when the resulting
> string is empty or consists solely of whitespace)?
>

I wonder where the error comes from... happens on Linux as well. Perhaps
the pipe | is causing it?

the problem is echo command because when you call 'echo
--interface-description' you get (surprisingly) '--interface-description'
(not error like any other bash command would raise). For other bash
commands (e.g. ls) you get (after ls output):

Unable to fetch interface description for command 'ls'.
Details: ls: unrecognized option '--interface-description'
Try `ls --help' for more information.

Please try r56388, there should be no error. But on Linux, pipe does not
seem to work as expected, anyway.

Anna

Markus
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Thu, May 23, 2013 at 7:12 PM, Anna Petrášová <kratochanna@gmail.com> wrote:
...

Please try r56388, there should be no error. But on Linux, pipe does not
seem to work as expected, anyway.

I had finallz the possibilty to try the latest version via OSGeo4W,
the error is gone.
Thanks!

Markus