Opened 15 years ago
Last modified 9 years ago
#945 new defect
wxGUI: g.setproj fails
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 6.4.6 |
Component: | wxGUI | Version: | svn-releasebranch64 |
Keywords: | g.setproj | Cc: | |
CPU: | All | Platform: | All |
Description
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.
Hamish
Change History (18)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
follow-up: 4 comment:3 by , 15 years ago
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\"". 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.
Hamish
follow-up: 5 comment:4 by , 15 years ago
Replying to 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().
comment:5 by , 15 years ago
follow-up: 8 comment:7 by , 15 years ago
tested, works in 6.4.0nightly wingrass wxGUI.
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'
? (python doesn't like it)
Hamish
comment:8 by , 15 years ago
Replying to hamish:
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.
comment:9 by , 14 years ago
Priority: | major → minor |
---|
status:
- original bug is fixed, g.setproj now works.
- The $GRASS_PAGER used is
less
, but Windows users won't have a clue how to use that. Suggest to set it tomore
in the startup script (see comment:7)
- GRASS_MESSAGE_FORMAT ugliness remains, see previous two comments in this ticket for a possible solution.
Hamish
comment:10 by , 14 years ago
Milestone: | 6.4.0 → 6.4.2 |
---|
comment:11 by , 13 years ago
Cc: | removed |
---|---|
Owner: | changed from | to
Status: | assigned → new |
comment:12 by , 13 years ago
Milestone: | 6.4.2 → 6.5.0 |
---|---|
Priority: | minor → major |
Version: | svn-releasebranch64 → svn-develbranch6 |
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)
Hamish
comment:13 by , 12 years ago
Milestone: | 6.5.0 → 6.4.4 |
---|---|
Version: | svn-develbranch6 → svn-releasebranch64 |
Still broken in current winGRASS 6.4 (r55719):
wxGUI menu -> Settings -> Map projection -> g.setproj:
Traceback (most recent call last): File "C:\Program Files (x86)\GRASS GIS 6.4.3svn\etc\wxpython\lmgr\frame.py", line 1186, in OnXTermNoXMon self.OnXTerm(event, need_xmon = False) File "C:\Program Files (x86)\GRASS GIS 6.4.3svn\etc\wxpython\lmgr\frame.py", line 1236, in OnXTerm p = Command(cmdlist, wait=False) NameError : global name 'Command' is not defined
Perhaps trap this when platform == windows and pop up an error "Unsupported on Windows, use blabla... instead"?
comment:14 by , 12 years ago
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.
Hamish
comment:15 by , 11 years ago
CPU: | x86-32 → All |
---|---|
Keywords: | wingrass removed |
Platform: | MSWindows XP → All |
Priority: | major → critical |
Summary: | wxGUI: g.setproj fails on wingrass → wxGUI: g.setproj fails |
It's not just WinGrass, it happens on Linux too.
r.digit and r.le.setup also fail in the same way.
This is a regression from 6.4.2, where it was working.
Hamish
comment:16 by , 11 years ago
Milestone: | 6.4.4 → 6.4.3 |
---|
comment:17 by , 11 years ago
Milestone: | 6.4.3 → 6.4.4 |
---|---|
Priority: | critical → major |
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 ...
Hamish
comment:18 by , 9 years ago
Milestone: | 6.4.4 → 6.4.6 |
---|
or if we were feeling lazy we could just hardcode