[GRASS-user] script by bash to Python

Glynn Clements glynn at gclements.plus.com
Wed Sep 24 09:21:46 EDT 2008


Gabriele N. wrote:

> All my scripts in bash work with tcltk.
> 
> Now, I take as example my 2 scripts: v.to.dem.sh and v.impact.sh.
> With WxPython all the scripts were not working with grass 63. With Grass64,
> instead, some scripts works (es v.impact.sh) and some other scripts does not
> works (es.v.to.dem.sh). But I do not know what may be the characteristic
> that makes v.impact.sh work and that does not work v.to.dem.sh.
> 
> I hope to have been clearer.
> 
> Thanks :-)
> 
> Gabriele
> 
> PS
> The error is always the same. Here's an example:
> GRASS 6.4.svn (gb2):~ > v.to.dem.sh 
> Traceback (most recent call last):
>   File "/usr/local/grass-6.4.svn/etc/wxpython/gui_modules/menuform.py", line 1687, in <module>
>     GrassGUIApp( grassTask( sys.argv[1] ) ).MainLoop()
>   File "/usr/local/grass-6.4.svn/etc/wxpython/gui_modules/menuform.py", line 193, in __init__
>     xml.sax.parseString( getInterfaceDescription( grassModule ) , processTask( self ) )
>   File "/usr/lib/python2.5/xml/sax/__init__.py", line 49, in parseString
>     parser.parse(inpsrc)
>   File "/usr/lib/python2.5/xml/sax/expatreader.py", line 107, in parse
>     xmlreader.IncrementalParser.parse(self, source)
>   File "/usr/lib/python2.5/xml/sax/xmlreader.py", line 123, in parse
>     self.feed(buffer)
>   File "/usr/lib/python2.5/xml/sax/expatreader.py", line 211, in feed
>     self._err_handler.fatalError(exc)
>   File "/usr/lib/python2.5/xml/sax/handler.py", line 38, in fatalError
>     raise exception
> xml.sax._exceptions.SAXParseException: <unknown>:21:73: not well-formed
> (invalid token)

This indicates the the output from

	v.to.dem.sh --interface-description

isn't valid XML.

This is likely to be caused by the contents of the option descriptions
at the top of the script (the #% lines).

Does one of the entries have <unknown> as its value? If so, which
field (gisprompt, label, etc) is it in?

I suspect that the code which generates the XML data isn't always
converting <, > and & to &lt;, &gt; and &amp; when it should.

You can work around the problem by using e.g. (unknown), but we should
really fix this in the code which generates the XML.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list