Opened 14 years ago
Closed 9 years ago
#1101 closed defect (fixed)
WinGrass7 + scripts are not found in the command line
Reported by: | hellik | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.0 |
Component: | Packaging | Version: | svn-trunk |
Keywords: | wingrass, scripts | Cc: | |
CPU: | Unspecified | Platform: | MSWindows Vista |
Description (last modified by )
Hi,
a in the osgeo4w-tree self compiled and NSIS-packaged and -installed
Wingrass7 (r42681)
starting WinGrass7 with the "GRASS 7.0.SVN with MSYS"-desktop-shortcut.
in the wx-gui-commandline all exe's(living in C:\Program
Files\GRASS-70-SVN\bin) and scripts (living in C:\Program Files\GRASS-70-SVN\scripts) are found.
if i want to start a script (living in C:\Program
Files\GRASS-70-SVN\scripts) in the msys-windows-command-line, the scripts are not found (see messages below or attached screenshot):
GRASS 7.0.svn> r.flow GRASS 7.0.svn> r.covar GRASS 7.0.svn> g.manual sh.exe": g.manual: command not found GRASS 7.0.svn> r.grow sh.exe": r.grow: command not found GRASS 7.0.svn> r.in.wms sh.exe": r.in.wms: command not found GRASS 7.0.svn>
Helmut
Attachments (1)
Change History (17)
by , 14 years ago
Attachment: | WinGrass_scripts_30062010_225838.png added |
---|
comment:1 by , 14 years ago
Description: | modified (diff) |
---|
comment:2 by , 14 years ago
Replying to hellik:
It appears that Markus edited the description rather than replying. Can you delete this and open a new ticket?
comment:3 by , 14 years ago
Description: | modified (diff) |
---|
Replying to hellik:
GRASS 7.0.svn> g.manual sh.exe": g.manual: command not foundThe spurious " is strange... maybe a quoting issue?
comment:4 by , 14 years ago
GRASS 7.0.svn> g.manual sh.exe": g.manual: command not found
The spurious " is strange... maybe a quoting issue?
follow-up: 6 comment:5 by , 14 years ago
Replying to hellik:
GRASS 7.0.svn> g.manual sh.exe": g.manual: command not found
Check the setting of %GRASS_SH%
.
It should be set with something like:
set GRASS_SH=C:\msys\1.0\bin\sh.exe
or:
set GRASS_SH=C:\Program Files\GRASS-70-SVN\msys\1.0\bin\sh.exe
There shouldn't be any quotes, even if the filename contains spaces.
comment:6 by , 14 years ago
Replying to glynn:
Replying to hellik:
GRASS 7.0.svn> g.manual sh.exe": g.manual: command not foundCheck the setting of
%GRASS_SH%
.It should be set with something like:
set GRASS_SH=C:\msys\1.0\bin\sh.exeor:
set GRASS_SH=C:\Program Files\GRASS-70-SVN\msys\1.0\bin\sh.exeThere shouldn't be any quotes, even if the filename contains spaces.
in grass70.bat, which invokes grass70.py, there is:
[...] rem Set GRASS Installation Directory Variable set GISBASE=C:\Program Files\GRASS-70-SVN [...] rem Path to the shell command set GRASS_SH=%GISBASE%\msys\bin\sh.exe
and in the WinGrass7-command line:
GRASS 7.0.svn> echo $GRASS_SH C:\Program Files\GRASS-70-SVN\msys\bin\sh.exe GRASS 7.0.svn>
and sh.exe is in C:\Program Files\GRASS-70-SVN\msys\bin
Helmut
follow-up: 9 comment:8 by , 13 years ago
follow-up: 10 comment:9 by , 13 years ago
Replying to glynn:
Replying to hamish:
still broken?
7.0 no longer has any shell scripts, so this should be moot.
tested with WinGRASS-7.0.SVN-r48376-1-Setup.exe
{{{ _ _
/ / \/ | / _/ _/ / / _/ _/
/ / / /_/ / /| | \
_ \ / / / / \ \
/ /_/ / _, _/ _ |_/ // / / /_/ / _/ / \/_/ |_/_/ |_/// \/_/
Welcome to GRASS 7.0.svn (2011)
GRASS homepage: http://grass.osgeo.org This version running through: shell (C:\Program Files\GRASS 7.0.SVN\msys\bin\sh.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
Launching 'wxpython' GUI in the background, please wait... GRASS 7.0.svn> g.manual sh.exe": g.manual: command not found GRASS 7.0.svn> r.grow sh.exe": r.grow: command not found GRASS 7.0.svn> r.in.wms sh.exe": r.in.wms: command not found GRASS 7.0.svn> echo $GRASS_SH C:\Program Files\GRASS 7.0.SVN\msys\bin\sh.exe GRASS 7.0.svn> g.manual -ui sh.exe": g.manual: command not found GRASS 7.0.svn> }}}
? Helmut
follow-up: 11 comment:10 by , 13 years ago
Replying to hellik:
better layout of the messages
__________ ___ __________ _______________ / ____/ __ \/ | / ___/ ___/ / ____/ _/ ___/ / / __/ /_/ / /| | \__ \\_ \ / / __ / / \__ \ / /_/ / _, _/ ___ |___/ /__/ / / /_/ // / ___/ / \____/_/ |_/_/ |_/____/____/ \____/___//____/ Welcome to GRASS 7.0.svn (2011) GRASS homepage: http://grass.osgeo.org This version running through: shell (C:\Program Files\GRASS 7.0.SVN\msys\bin\sh.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 Launching 'wxpython' GUI in the background, please wait... GRASS 7.0.svn> g.manual sh.exe": g.manual: command not found GRASS 7.0.svn> r.grow sh.exe": r.grow: command not found GRASS 7.0.svn> r.in.wms sh.exe": r.in.wms: command not found GRASS 7.0.svn> echo $GRASS_SH C:\Program Files\GRASS 7.0.SVN\msys\bin\sh.exe GRASS 7.0.svn> g.manual -ui sh.exe": g.manual: command not found GRASS 7.0.svn>
any hints to look why there seems to be tried invoking shell scripts instead of the phytonized scripts in grass70svn?
Helmut
follow-up: 12 comment:11 by , 13 years ago
Replying to hellik:
any hints to look why there seems to be tried invoking shell scripts instead of the pythonized scripts in grass70svn?
- Does %PATH% contain the "scripts" directory?
- Does PATHEXT include ".PY"?
#2 isn't required for bash, which will recognise the "#!/usr/bin/env python" lines provided that there's a Python interpreter in $PATH (which shouldn't be the case, but probably is with the OSGeo4W setup). But cmd.exe (and Python itself) will use the file associations for the .PY extension (which Python will set up if it's installed correctly).
BTW, I believe that the "sh.exe" is because you're typing the commands into the shell, not because something is trying to execute the command as a shell script.
follow-up: 13 comment:12 by , 13 years ago
follow-up: 14 comment:13 by , 13 years ago
Replying to martinl:
- Does PATHEXT include ".PY"?
yes
When I type
g.manual
->
command not found
Of course
g.manual.py
works.
I'm forgetting that we're dealing with bash here. bash ignores PATHEXT, and it doesn't use file extensions either (except perhaps .bat?).
OTOH, cmd.exe uses PATHEXT and file extensions but ignores the shebang. And, on Windows, GRASS' G_spawn(), C's system() and Python's os.system() and subprocess.Popen() all use cmd.exe, not bash.
If we want Python scripts to work in bash, I suspect that we'll need to create shell-script wrappers without the .py extension which invoke the script via e.g. $GRASS_PYTHON. Or just require users to type the ".py" when running scripts from a shell. Or, if we're only interested in shells which are started by GRASS, we can customise the .bashrc file to define aliases for all of the Python scripts, e.g.:
alias g.manual='"$GRASS_PYTHON" "$GISBASE/scripts/g.manual.py"' ...
Ultimately, using bash on Windows is always going to be a pain; it's a struggle just to achieve "adequate", and almost impossible to go beyond that. But I don't know whether bash support really matters to actual Windows users (as opposed to GRASS developers who are running WinGRASS solely for testing purposes).
The priority should be to ensure that "native" support works, i.e. invoking scripts from the GUI, cmd.exe, Python scripts and C programs. Personally, I'd prefer it if Windows+bash support was limited to information on the Wiki, so that users understand that it's a "use at your own risk" feature.
comment:14 by , 13 years ago
Replying to glynn:
I'm forgetting that we're dealing with bash here. bash ignores PATHEXT, and it doesn't use file extensions either (except perhaps .bat?).
OTOH, cmd.exe uses PATHEXT and file extensions but ignores the shebang. And, on Windows, GRASS' G_spawn(), C's system() and Python's os.system() and subprocess.Popen() all use cmd.exe, not bash.
at the moment wingrass7 "GRASS 7.0.SVN with MSYS" is started in the following way:
set_shell_start_grass70svn.bat is invoked
@echo off rem ######################################################################### rem # rem # File dynamically created by NSIS installer script rem # rem ######################################################################### rem # rem # Set SHELL and start GRASS rem # rem ######################################################################### rem *******Set SHELL*********** set SHELL="C:\Program Files\GRASS 7.0.SVN\msys\bin\sh.exe" "C:\Program Files\GRASS 7.0.SVN\grass70svn.bat"
grass70svn.bat
@echo off rem ######################################################################### rem # rem # File dynamically created by NSIS installer script; rem # rem ######################################################################### rem # rem # GRASS Initialization rem # rem ######################################################################### rem Set GRASS Installation Directory Variable set GISBASE=C:\Program Files\GRASS 7.0.SVN set PATH=C:\Program Files\R\R-2.13.0\bin;%PATH% call "%GISBASE%\etc\env.bat" cd "%USERPROFILE%" %GRASS_PYTHON% "%WINGISBASE%\grass70.py" %*
and a cmd.exe-windows is opened as command line and the wy-gui is starting
Helmut
follow-up: 16 comment:15 by , 11 years ago
See also:
- #580 WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
- #1871 winGRASS 7: solve python distribution
- #2138 winGRASS6.4.svn - addon python script status?
- #2150 Cannot call Python scripts from Python on MS Windows
- Handling of Python scripts on MS Windows
- Handling of Python scripts on MS Windows (question how QGIS and OSGeo4W works)
- r54612 - source:grass/trunk/mswindows - wingrass: attempt to define python file association
comment:16 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to wenzeslaus:
See also:
- #580 WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
- #1871 winGRASS 7: solve python distribution
- #2138 winGRASS6.4.svn - addon python script status?
- #2150 Cannot call Python scripts from Python on MS Windows
- Handling of Python scripts on MS Windows
- Handling of Python scripts on MS Windows (question how QGIS and OSGeo4W works)
- r54612 - source:grass/trunk/mswindows - wingrass: attempt to define python file association
tested with
System Info GRASS version: 7.0.3RC1 GRASS SVN Revision: 67443 Build Date: 2015-12-31 Build Platform: i386-w64-mingw32 GDAL/OGR: 1.11.3 PROJ.4: 4.9.2 GEOS: 3.5.0 SQLite: 3.7.17 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
it works; closing ticket.
Replying to hellik: