[GRASS-dev] Re: [GRASS GIS] #580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run

GRASS GIS trac at osgeo.org
Sat Oct 3 00:23:49 EDT 2009

#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
  Reporter:  hamish        |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  wxGUI         |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass                 
  Platform:  MSWindows XP  |         Cpu:  Unspecified              
Comment (by glynn):

 Replying to [comment:4 hamish]:

 > %PATHEXT% is used to indicate that .py files are executable and usable
 without their extension. But this only seems to work from the DOS box
 version of WinGrass, not from the MSys xterm (no big surprise there).

 Right. MSys' bash emulates Unix execution semantics.

 Ultimately, WinGRASS is supposed to be "GRASS for Windows", not "GRASS for

 > Running a python script from the DOS prompt it fails though because it
 doesn't know what program to associate .PY with.
 > what is apparently missing is:
 set .py="%GISBASE%/extrabin\python.exe"

 I've never seen this syntax. The normal way to associate applications with
 extensions is via assoc and ftype (but AFAICT, those change the system-
 wide settings, which may have be overriden by per-user settings).

 > some random google hit shows it might need assoc + ftype as well,

 It's more likely to be "instead of". "set" sets environment variables,
 which have nothing to do with file associations.

 > so I add this all together in C:\GRASS-6-SVN\grass64.bat just after the
 set .py="%GRASSDIR%\extrabin\python.exe"
 assoc .py=Python.File
 ftype Python.File="%GRASSDIR%\extrabin\python.exe" "%1" "%*"
 assoc .pyw=Python.NoConFile
 ftype Python.NoConFile="%GRASSDIR%\extrabin\pythonw.exe" "%1" "%*"

 Note that this will change the registry keys, which will permanently
 affect the handling of all .py files on the system, not just those which
 are part of GRASS, and not just for the lifetime of the command prompt.

 Bundling a "local" copy of Python (with a matching copy of wxPython) may
 be a reasonable approach for getting the wxGUI working, but any standalone
 scripts will use the system Python installation, and GRASS shouldn't be
 interfering with that (applications which automatically "steal" file
 associations are generally considered to be malware).

 > and then "cd C:\GRASS-6-SVN\etc\gui\scripts" and v.type_wrapper<enter>
 finally launches python, but gives a "unknown option -e" error and shows
 the python.exe usage text.
 > should {{{ set PYTHONPATH="%GRASSDIR%\etc\python" }}} be set in
 C:\GRASS-6-SVN\grass64.bat as well?

 Probably not. This should only be set when invoking a Python script using
 the bundled copy of Python. Scripts run from the command prompt will use
 the system's Python, so you shouldn't be modifying PYTHONPATH in this

Ticket URL: <https://trac.osgeo.org/grass/ticket/580#comment:5>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list