[GRASS-dev] Re: trying wxgrass on Windows
Michael Barton
michael.barton at asu.edu
Fri Jun 15 20:15:59 EDT 2007
Moritz,
I'm very glad you've tried this on Windows. This is very important.
On 6/15/07 2:09 PM, "Moritz Lennert" <mlennert at club.worldonline.be> wrote:
> On Fri, June 15, 2007 10:07, Michael Barton wrote:
>> The new wxPython GRASS interface (AKA wxgrass) is pretty much equal in
>> functionality to the standard TclTk interface, and so is ready for regular
>> testing.
>
> I decided to give it a try on Windows, directly launching 'python
> wxgui.py' from within a grass session in cmd.exe.
>
> There were quite a few errors, of which I don't know whether they are due
> to the fact that this is windows (the first is) or because of path
> definition issues or similar specificities.
>
> In cmd.py you have the following function call on line 89:
>
> self.module = subprocess.Popen(self.cmd,
> stdin=subprocess.PIPE,
> stdout=subprocess.PIPE,
> stderr=subprocess.PIPE,
> close_fds=True)
>
> However, close_fds is not supported on Windows...
>
> I can solve this by setting usePopenClass = False at line 25.
cmd.Command is designed primarily to pass commands through Popen.
Setting usePopenClass passes all commands to popen3.
This is a backup for cases where subprocess.Popen is not available, but I
doubt that this has been tested much or at all. In fact, we are set up to
use an independent version of subprocess, if it is not available within
Python.
IMHO, it would be better to deal with the close_fds argument than to reroute
all commands on Windows systems through popen3. I wouldn't be surprised if
this is at the bottom of the other errors you are getting.
We can either dispense with close_fds or add an if clause to have a version
of Popen without close_fds for Windows systems and with close_fds for the
rest of the systems.
Michael
>
> I then get (end of the traceback):
>
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\mapdisp.py", line 1313,
> in __init__
> self.projinfo = self.Map.ProjInfo()
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\render.py", line 460, in
> ProjInfo
> p = cmd.Command(cmdlist)
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\cmd.py", line 134, in
> __init__
>
> (self.cmd, wait, self.returncode))
> TypeError: int argument required
>
> Line 134 is part of a debug message, so I can just comment it out
> (although we should try to identify the reason for the error). This then
> leads to the wxgrass windows opening.
>
> Whenever I try to launch a command from the menu I get something like this:
>
> File "c:\grass\grass-6.3.cvs\etc\wx\wxgui.py", line 377, in OnMenuCmd
> menuform.GUI().ParseCommand(cmd,gmpath, parentframe=self)
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\menuform.py", line 1110,
> in ParseCommand
> xml.sax.parseString( getInterfaceDescription( cmd ) , handler )
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\menuform.py", line 1059,
> in getInterfaceDescription
> cmdout = p.sub( gmpath+r'/grass-interface.dtd', cmdout)
> File "C:\Programme\Python25\lib\re.py", line 261, in _subx
> template = _compile_repl(template, pattern)
> File "C:\Programme\Python25\lib\re.py", line 248, in _compile_repl
> raise error, v # invalid expression
> sre_constants.error: bad group name
>
> Similar error when adding a vector or raster layer:
>
> File "c:\grass\grass-6.3.cvs\etc\wx\wxgui.py", line 693, in AddRaster
> self.curr_page.maptree.AddLayer('raster')
> File "C:\GRASSSRC\gui\gui_modules\wxgui_utils.py", line 446, in AddLayer
> self.PropertiesDialog(layer)
> File "C:\GRASSSRC\gui\gui_modules\wxgui_utils.py", line 459, in
> PropertiesDialog
> menuform.GUI().ParseCommand('d.rast', gmpath,
> completed=(self.getOptData,layer,params), parentframe=self)
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\menuform.py", line 1110,
> in ParseCommand
> xml.sax.parseString( getInterfaceDescription( cmd ) , handler )
> File "c:\grass\grass-6.3.cvs\etc\wx\gui_modules\menuform.py", line 1059,
> in getInterfaceDescription
> cmdout = p.sub( gmpath+r'/grass-interface.dtd', cmdout)
> File "C:\Programme\Python25\lib\re.py", line 261, in _subx
> template = _compile_repl(template, pattern)
> File "C:\Programme\Python25\lib\re.py", line 248, in _compile_repl
> raise error, v # invalid expression
> sre_constants.error: bad group name
>
>
> Moritz
>
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
More information about the grass-dev
mailing list