[GRASS-user] wxpython fails to open existing grc

I just upgraded from 6.3 RC 4 to 6.3 RC5 (using William Kyngesburye’s binaries on a Mac).
Now when I open the wxpython gui, if I try to open an existing .grc file it doesn’t open and I get the following errors:

Traceback (most recent call last):
File “/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py”, line 524, in OnWorkspaceOpen
self.LoadGrcXmlToLayerTree(filename)
File “/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py”, line 569, in LoadGrcXmlToLayerTree
xml.sax.parseString(fileStream, grcXml)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/init.py”, line 49, in parseString
parser.parse(inpsrc)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py”, line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/xmlreader.py”, line 123, in parse
self.feed(buffer)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py”, line 211, in feed
self._err_handler.fatalError(exc)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/handler.py”, line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: :1:0: syntax error

This didn’t happen with RC4 and doesn’t happen with the RC5 when using the tcl GUI.

–Adam

Hi Adam,

hm, I guess you created the grc file in gis.m. The format is
completely different in wxPython GUI, see

http://trac.osgeo.org/grass/ticket/77

File extension must be changed otherwise users will be confused.

Martin

2008/3/4, Adam Dershowitz <adershowitz@exponent.com>:

I just upgraded from 6.3 RC 4 to 6.3 RC5 (using William Kyngesburye's
binaries on a Mac).
Now when I open the wxpython gui, if I try to open an existing .grc file it
doesn't open and I get the following errors:

Traceback (most recent call last):
  File
"/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 524, in OnWorkspaceOpen
    self.LoadGrcXmlToLayerTree(filename)
  File
"/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 569, in LoadGrcXmlToLayerTree
    xml.sax.parseString(fileStream, grcXml)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/__init__.py",
line 49, in parseString
    parser.parse(inpsrc)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py",
line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/xmlreader.py",
line 123, in parse
    self.feed(buffer)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py",
line 211, in feed
    self._err_handler.fatalError(exc)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/handler.py",
line 38, in fatalError
    raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0:
syntax error

This didn't happen with RC4 and doesn't happen with the RC5 when using the
tcl GUI.

--Adam

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

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

Thanks. Yes, I created the files with the gis.m tck interface. So, I am (OK...was) a confused user.
But that raises a few questions about the development of the wx interface:
Is there a way to convert tcl grc files over to wx grc files? Generally, it is important in my opinion to keep backward compatibility in code. Otherwise, as the wx gui takes over, as I believe is the longer term plan, then old files will no longer be useable, which is not good.
Also, it seems to me that instead of a syntax errors, if the file can't be interpreted as proper xml that the wx interface could display an error that this is not a valid file. That would help cut down on the confusion indicated above.

Thanks,

--Adam

On Mar 4, 2008, at 11:54 AM, Martin Landa wrote:

Hi Adam,

hm, I guess you created the grc file in gis.m. The format is
completely different in wxPython GUI, see

http://trac.osgeo.org/grass/ticket/77

File extension must be changed otherwise users will be confused.

Martin

2008/3/4, Adam Dershowitz <adershowitz@exponent.com>:

I just upgraded from 6.3 RC 4 to 6.3 RC5 (using William Kyngesburye's
binaries on a Mac).
Now when I open the wxpython gui, if I try to open an existing .grc file it
doesn't open and I get the following errors:

Traceback (most recent call last):
File
"/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 524, in OnWorkspaceOpen
   self.LoadGrcXmlToLayerTree(filename)
File
"/Applications/GRASS-6.3.app/Contents/MacOS/etc/wxpython/wxgui.py",
line 569, in LoadGrcXmlToLayerTree
   xml.sax.parseString(fileStream, grcXml)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/__init__.py",
line 49, in parseString
   parser.parse(inpsrc)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py",
line 107, in parse
   xmlreader.IncrementalParser.parse(self, source)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/xmlreader.py",
line 123, in parse
   self.feed(buffer)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/expatreader.py",
line 211, in feed
   self._err_handler.fatalError(exc)
File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xml/sax/handler.py",
line 38, in fatalError
   raise exception
xml.sax._exceptions.SAXParseException: <unknown>:1:0:
syntax error

This didn't happen with RC4 and doesn't happen with the RC5 when using the
tcl GUI.

--Adam

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

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

Hi,

2008/3/4, Adam Dershowitz <adershowitz@exponent.com>:

Is there a way to convert tcl grc files over to wx grc files?

unfortunately there is no format convector available now, it would be
useful I guess. Please report a wish ticket in Trac for that,
otherwise it will be forgotten;-) To compare grc's formats

grc created by gis.m

Raster aspect@PERMANENT
  _check 1
  opacity 1.0
  map aspect@PERMANENT
  drapemap
  brighten 0
  querytype cat
  rastquery
  rasttype
  bkcolor
  overlay 1
End

workspace file created by wxGUI

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE grc SYSTEM "grass-grc.dtd">
<grc>
    <display>
        <layer type="raster" name="aspect@PERMANENT" checked="1"
opacity="1.000000">
            <task name="d.rast">
                <parameter name="map">
                    <value>aspect@PERMANENT</value>
                </parameter>
            </task>
        </layer>
    </display>
</grc>

Generally, it is important in my opinion to keep backward
compatibility in code. Otherwise, as the wx gui takes over, as I
believe is the longer term plan, then old files will no longer be
useable, which is not good.

yes, the format convector would make sense here. Anyway the format
definitions are completely different in this case, no backward
compatibility.

Also, it seems to me that instead of a syntax errors, if the file
can't be interpreted as proper xml that the wx interface could display
an error that this is not a valid file. That would help cut down on
the confusion indicated above.

This I have fixed in trunk few minutes ago:-) Good point.

http://trac.osgeo.org/grass/changeset/30469

Regards, Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *