#945: wxGUI: g.setproj fails on wingrass
---------------------------------+------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-releasebranch64
Keywords: g.setproj, wingrass | Platform: MSWindows XP
Cpu: x86-32 |
---------------------------------+------------------------------------------
Hi,
(moved here from #693)
g.setproj fails on wxGUI wingrass 6.4.0.
the error is
{{{
Traceback (...):
File "c:/Program Files/GRASS-64-SVN/etc/wxpython/wxgui.py", line 991, in
OnXterm
xmon = xmonlist[0]
IndexError
:
list index out of range
}}}
the main problem here is that g.setproj wants a terminal but it doesn't
need a Xmon. So the menuform.xml hander should be changed to something
new.
Currently OnXterm has a function parameter of NeedXmon = True/False (or
something like that) which defaults to True. If we could figure out how to
pass that option = False as part of the XML menu tree it would solve it.
Alternatively we could split out a new handler function, but it would
mostly be duplication and only used for g.setproj.
Windows cannot find "\"c:Program Files/GRASS-64-SVN\etc\grass-run.bat\"".
Make sure you typed the name correctly, and then try again.
To search for a file, click the Start button, and then click
Search.
[Ok]
}}}
from the MSys terminal prompt I correctly get the "You must be in the
PERMANENT mapset to run this" error message; from the wxGUI Cmd> prompt I
get the popup module auto-GUI but nothing at all happens when I click
[Run].
from the GIS.m tcl gui it flashes open a DOS box with the "you must be in
PERMANENT.." error and a beep, and then after 250ms the dosbox closes
again. You just have time to read the error message.
Replying to [comment:3 hamish]:
> with the 6.4 nightly wingrass binary r41114 wxGUI, I get this error
popup when I try to start g.setproj from the Config->Manage projections
menu:
>
{{{
__ \"c:/Program Files/GRASS-64-SVN\etc\grass-run.bat\" __
Windows cannot find "\"c:Program Files/GRASS-64-SVN\etc\grass-run.bat\"".
}}}
IOW, OnXTerm() is still as broken as it always was. In particular, I note:
{{{
cmdlist = ["cmd.exe", "/c", 'start "%s"' % runbat, command]
}}}
Try using:
{{{
cmdlist = ["start", runbat, command]
}}}
then running the command with shell=True (if this isn't already set, which
it should be).
Also try not using gcmd.Command(). It appears to be intended to run GRASS
commands, and neither cmd.exe nor start are GRASS commands. It's also
insanely hard to figure out what's going on once you get into
gcmd.Command().
one annoyance is that $GRASS_PAGER is set to be `less` instead of `more`.
`more` seems to be a DOS built-in function, so msys startup/prompt can't
detect/use it.
The nice thing about `more` is that you don't need to know how to use it,
you just smash the keyboard until it goes away. For `less` you do need to
know to use the `q` key to get out (easy once you know, not if you don't).
another is that OnXTerm should unset the GRASS_MESSAGE_FORMAT enviro var
to avoid printing GRASS_INFO_WARNING(), GRASS_INFO_END() etc. to the
terminal.
{{{
# unset
del os.environ['GRASS_MESSAGE_FORMAT']
...
# reset
os.environ['GRASS_MESSAGE_FORMAT'] = 'gui'
}}}
> another is that OnXTerm should unset the GRASS_MESSAGE_FORMAT enviro var
to avoid printing GRASS_INFO_WARNING(), GRASS_INFO_END() etc. to the
terminal.
>
{{{
# unset
del os.environ['GRASS_MESSAGE_FORMAT']
...
# reset
os.environ['GRASS_MESSAGE_FORMAT'] = 'gui'
}}}
Apart from at startup, the wxGUI should just leave os.environ alone. If a
child process needs a modified environment, pass it one via the env=
parameter to subprocess.Popen(), e.g.:
{{{
tmpenv = os.environ.copy()
tmpenv['GRASS_MESSAGE_FORMAT'] = 'gui'
p = grass.Popen(..., env = tmpenv)
}}}
If gcmd.Command doesn't support env=, it needs to be fixed.
* The $GRASS_PAGER used is `less`, but Windows users won't have a clue
how to use that. Suggest to set it to `more` in the startup script (see
comment:7)
* GRASS_MESSAGE_FORMAT ugliness remains, see previous two comments in
this ticket for a possible solution.
* priority: minor => major
* version: svn-releasebranch64 => svn-develbranch6
* milestone: 6.4.2 => 6.5.0
Comment:
Hi, (reusing this ticket as it's still open)
all OnXTerm and OnXTermNoXMon menu items are failing on 6.5svn wingrass.
In 6.4.2svn they are ok. e.g. for g.setproj from the Settings menu:
{{{
Traceback:
File .../lmgr/frame.py line 1122, in OnXTermNoXMon
self.OnXTerm(event, need_xmon = false)
File .../lmgr/frame.py line 1172, in OnXTerm
p = Command(cmdlist, wait=False)
NameError
:
global name 'Command' is not defined
}}}
see also outstanding issues in comment:9 (the most important of which is
that GRASS_PAGER on wingrass should be set to use `more` not `less`, as
all you need to know to use that program is if you smash the keyboard
enough times you can get it to go away)
#945: wxGUI: g.setproj fails on wingrass
---------------------------------+------------------------------------------
Reporter: hamish | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: g.setproj, wingrass | Platform: MSWindows XP
Cpu: x86-32 |
---------------------------------+------------------------------------------
Comment(by hamish):
see comment:9 and comment:12.
In 6.4.2svn it *was* working, but something in the GUI got backported
which then broke it. We should be able to fix this, I'm pretty sure it's
not a fundamental problem, just a fiddly one.
note g.setproj is still the only way to access creating US State FIPS code
locations by county, and it's nice to have the fall-back since +proj codes
do not cover all possibilities that GRASS supports AFAIK. The wxPy loc'n
wizard is absolutely wonderful, best I've used, but there's still another
2% to go before it's universal.
OnXTerm 'Command' error fixed in relbr64 and devbr6 with r56738,40.
`more` set to be the default pager in wingrass in r56741 (devbr6).
works within g.setproj run from the msys command line or wxGUI, but not
from the msys command line directly (fails gracefully, cat-like).
#945: wxGUI: g.setproj fails
-----------------------+----------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 6.4.4
Component: wxGUI | Version: svn-releasebranch64
Keywords: g.setproj | Platform: All
Cpu: All |
-----------------------+----------------------------------------------------
Changes (by hamish):
* priority: critical => major
* milestone: 6.4.3 => 6.4.4
Comment:
re. the pager problem, actually it wasn't failing gracefully, it was #ifdef'd out for wingrass. #ifdef removed, tested the pager with g.list
and g.setproj in devbr6 and it works now with the isatty()-able cmd.exe
window. backported to 6.4svn in r56780.
r.digit and g.setproj now start ok from the wxGUI menu, with and without
Xmons.
----
Final issue to resolve before closing this bug:
* GRASS_MESSAGE_FORMAT ugliness remains, see comment:7 and comment:8 in
this ticket for a possible solution.
that's not critical, so bumping it down the road to 6.4.4 ...