Opened 14 years ago
Closed 14 years ago
#1137 closed defect (fixed)
wxGUI doesn't work in Windows
Reported by: | glynn | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | 6.4.0 |
Component: | wxGUI | Version: | unspecified |
Keywords: | Cc: | ||
CPU: | All | Platform: | MSWindows XP |
Description
In menuform.py, getInterfaceDescription() attempts to insert the full path to grass-interface.dtd in the --interface-description output, using:
p = re.compile('(grass-interface.dtd)') p.search(cmdout) cmdout = p.sub(globalvar.ETCDIR + r'/grass-interface.dtd', cmdout)
But the first argument to the RegexObject.sub() method is a replacement pattern, not a literal string, meaning that certain backslash sequences have special meaning.
This is problematic if globalvar.ETCDIR contains a recognised backslash sequence, which is quite likely on Windows. In particular, \g is used to insert the contents of a named or numbered group, and ETCDIR will almost certainly contain this sequence as part of "\grass-". This results in the error:
File "C:\msys\1.0\home\glynn\src\grass-7.0\dist.i686-pc-mingw32\etc\gui\wxpython\gui_modules\menuform.py", line 1997, in getInterfaceDescription cmdout = p.sub(globalvar.ETCDIR + r'/grass-interface.dtd', cmdout) File "C:\Program Files\Python26\lib\re.py", line 273, in _subx template = _compile_repl(template, pattern) File "C:\Program Files\Python26\lib\re.py", line 260, in _compile_repl raise error, v # invalid expression sre_constants.error: bad group name
Also, even without the error, the "\1" in "\1.0" would end up being replaced by the first parenthesised group (grass-interface.dtd).
As the pattern is a literal string, I don't see any reason to use regular expression. It may as well just use e.g.:
cmdout.replace('grass-interface.dtd', os.path.join(globalvar.ETCDIR, 'grass-interface.dtd'))
which also fixes the use of the wrong directory separator.
Also, if the DTD is supposed to be specified by a full path, the implementation of --interface-description should be fixed, rather than patching the output afterwards.
Priority set to "blocker" as this can make the wxGUI effectively non-functional. Executing any command will trigger the error if $GISBASE contains the wrong characters (this may be specific to Python 2.6; I can't see any other reason why it wouldn't have been noticed earlier).
Platform set to "MSWindows" (applies to all versions) as backslashes in pathnames are uncommon on other platforms (although technically permitted).
Tested with the latest 7.0, but the code is identical in 6.x.
Change History (8)
follow-up: 2 comment:1 by , 14 years ago
comment:2 by , 14 years ago
follow-up: 4 comment:3 by , 14 years ago
follow-up: 6 comment:5 by , 14 years ago
follow-up: 7 comment:6 by , 14 years ago
Replying to martinl:
Replying to glynn:
Replying to martinl:
is r43266 sufficient fix?
I think so.
backported to devbr6 (r43274) and relbr64 (r43275). WinGrass packages will be available at http://josef.fsv.cvut.cz/wingrass/grass64/ within one hour, please test.
I've tried r43283
syringia@NADA /c/osgeo4w/usr/src/grass_trunk/bin.i686-pc-mingw32 $ grass70 syringia@NADA /c/osgeo4w/usr/src/grass_trunk/bin.i686-pc-mingw32 $ Cleaning up temporary files... Starting GRASS GIS... WARNUNG: Attention! WARNUNG: Locking is not supported on Windows! __________ ___ __________ _______________ / ____/ __ \/ | / ___/ ___/ / ____/ _/ ___/ / / __/ /_/ / /| | \__ \\_ \ / / __ / / \__ \ / /_/ / _, _/ ___ |___/ /__/ / / /_/ // / ___/ / \____/_/ |_/_/ |_/____/____/ \____/___//____/ Welcome to GRASS 7.0.svn (2010) GRASS homepage: http://grass.osgeo.org This version running through: shell (C:\windows\system32\cmd.exe) Help is available with the command: g.manual -i See the licence terms with: g.version -c If required, restart the GUI with: g.gui wxpython When ready to quit enter: exit Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. Alle Rechte vorbehalten. c:\osgeo4w\usr\src\grass_trunk\bin.i686-pc-mingw32>Cleaning up temporary files... Done. Goodbye from GRASS GIS Traceback (most recent call last): File "c:\osgeo4w\usr\src\grass_trunk\dist.i686-pc-mingw32\etc\gui\wxpython\wxgui.py", line 64, in <module> import gui_modules.preferences as preferences File "c:/osgeo4w/usr/src/grass_trunk/dist.i686-pc-mingw32/etc/gui/wxpython/gui_modules/preferences.py", line 909, in <module> globalSettings = Settings() File "c:/osgeo4w/usr/src/grass_trunk/dist.i686-pc-mingw32/etc/gui/wxpython/gui_modules/preferences.py", line 591, in __init__ self.ReadSettingsFile() File "c:/osgeo4w/usr/src/grass_trunk/dist.i686-pc-mingw32/etc/gui/wxpython/gui_modules/preferences.py", line 653, in ReadSettingsFile gisdbase = gisenv['GISDBASE'] KeyError: 'GISDBASE'
follow-up: 8 comment:7 by , 14 years ago
Replying to hellik:
Replying to martinl:
Replying to glynn:
Replying to martinl:
is r43266 sufficient fix?
I think so.
backported to devbr6 (r43274) and relbr64 (r43275). WinGrass packages will be available at http://josef.fsv.cvut.cz/wingrass/grass64/ within one hour, please test.
I've tried r43283
It wasn't indented to fix grass.py script. The original report
This is problematic if globalvar.ETCDIR contains a recognised backslash sequence, which is quite likely on Windows. In particular, \g is used to insert the contents of a named or numbered group, and ETCDIR will almost certainly contain this sequence as part of "\grass-". This results in the error:
comment:8 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to martinl:
> This is problematic if globalvar.ETCDIR contains a recognised backslash > sequence, which is quite likely on Windows. In particular, \g is used to > insert the contents of a named or numbered group, and ETCDIR will almost > certainly contain this sequence as part of "\grass-". This results in the error:
I am closing this ticket, please reopen if needed. Martin
See also #1015 and #1017