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

14 messages Options
Embed this post
Permalink
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
-------------------------+--------------------------------------------------
 Reporter:  hamish       |       Owner:  [hidden email]
     Type:  defect       |      Status:  new                      
 Priority:  blocker      |   Milestone:  6.4.0                    
Component:  wxGUI        |     Version:  6.4.0 RCs                
 Keywords:  wingrass     |    Platform:  MSWindows XP            
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------
 Hi,

 None of the GUI wrapper scripts called from the GUI menus work in WinGRASS
 due to lack of associated file extensions.

 these are the shell and python scripts installed in
 $GISBASE/etc/gui/scripts/

 explained here:
  http://thread.gmane.org/gmane.comp.gis.grass.devel/32133

 see also bug #234.


 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 hamish):

 I may have solved the problem of the GUI scripts not running on WinGRASS
 with r37085, 86, 87. They were missing .bat wrappers. leaving bug open as
 I haven't properly tested it.


 '''TODO'''
  * grass 7: (gui/scripts/Makefile) fix (wildcard *.*) and then use with
 create.bat:
  * wxpython/scripts/Makefile: do p.* need .bat files too?
  * similar thing needed to get g.gui launcher to work on WinGRASS?


 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 hamish):

 still doesn't work for v.type_wrapper.py and g.change.gui.py using latest
 native wingrass installer (6.4.0.svn 2009-05-02).

 in wx it fails looking for the --interface-description.
 in tcl it just gives a red "X" in the output window, no error message.

 maybe need something like:
 {{{
  guiscritpspath = os.path.join(globalvar.ETCDIR, 'gui','scripts')
  sys.path.append(guiscriptspath)
 }}}
 ??


 (still doesn't work, similar error if called with --ui from the msys
 terminal prompt)


 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 hamish):

 This still doesn't work for v.type_wrapper.py and g.change.gui.py using
 latest native WinGrass installer (Colin's 6.4.0.svn r38537 2009-07-29).

 wxGUI `Vector -> Develop -> Convert object types` menu item gives a
 windows dialog:
 {{{
  Windows cannot open this file:
  File: v.type_wrapper.py
 To open this file, Windows needs to know what program created it. ...
 [*] Use the web service to find the approp prog
 [ ] Select the program from a list

         [ok] [cancel]
 }}}

 and if you press cancel the wxGui layer manager output tab comes back with
 a Traceback error ending in
 {{{
 ...
 IOError
 :
 Unable to fetch interface description for command
 'v.type_wrapper.py'.
 }}}


 `echo $PATHEXT` in the associated Msys terminal ends in ';.PY',
 so at least that part of lib/init/init.bat or init.sh is getting run.

 neither $PATH nor $PYTHONPATH includes $GISBASE/etc/gui/scripts/
 see this trac ticket log for some sys.path.append(guiscriptspath) ideas.



 also I'd note that NVIZ still doesn't start from the wxGUI:
 `File -> NVIZ (req tcltk)` brings up the NVIZ launch dialog and lets you
 select a map but when you hit [Run] it just returns after 0sec. Same if
 you try from the wxGui Cmd> prompt.  But if you type 'nviz -q' at the
 associated Msys terminal it brings it up ok.

 ??

 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 hamish):

 (working with Colin's native WinGrass installer r39271)

 %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).


 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"
 }}}

 but setting that in the DOS box doesn't associate it properly.

 (aside: strangely `dir "%GISBASE%/extrabin\python.exe"` succeeds while
 `dir "%GISBASE%/extrabin/python.exe"` fails at the DOS prompt)


 some random google hit shows it might need assoc + ftype as well, so I add
 this all together in C:\GRASS-6-SVN\grass64.bat just after the "set
 PYTHONHOME":

 {{{
 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" "%*"
 }}}

 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?


 ?,
 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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
 MSys".

 > 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 PYTHONHOME":
 >
 {{{
 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
 case.

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 hamish):

 Replying to [comment:4 hamish]:
 > > 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"
  }}}

 Replying to [comment:5 glynn]:
 > I've never seen this syntax.

 Nevermind, further down in the thread that suggested that is the small
 caveat that belongs to some NT4 3rd party replacement for cmd.exe (gee,
 thanks for the tip then).


 > 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).
 ...
 > 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.

 ... leading to more like bug #570


 So lacking a way to locally set the extension association, our only choice
 is to ditch PATHEXT and use wrapper scripts which ensure that the
 GRASS_PYTHON enviro var. is respected. Workable from the GUI, but running
 GRASS python modules from the command line will be at the mercy of
 whatever version of python the user has installed. (a python wrapper
 script which launched another (but this time known) version of python to
 run a script is probably asking for trouble)


 > Bundling a "local" copy of Python (with a matching copy of
 > wxPython) may be a reasonable approach for getting the wxGUI
 > working,

 (and even with doing that we still aren't close to mastering it)

 > but any standalone scripts will use the system Python
 > installation, and GRASS shouldn't be interfering with that

 is there anything left which won't use the python set by the GRASS_PYTHON
 enviro variable? (from #570 apparently the answer is yes)

 > (applications which automatically "steal" file associations are
 > generally considered to be malware).

 ... Windows would seem to have a lot of malware then ... at least the DLL
 version clobbering in favour of the last-to-run installer is less
 prevalent these days.


 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 cmbarton):

 Given all this, is there a way to run a Python script in GRASS for Windows
 now (i.e., by including some code in the script or its batch file) or will
 it have to wait until the GRASS code is changed?

 Michael

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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:6 hamish]:

 > > 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).
 > ...
 > > 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.
 >
 > ... leading to more like bug #570

 I thought that #570 related specifically to the GUI.

 Note that the GUI is a bit more problematic because it requires a version
 of Python with wx 2.8, and relying upon the system Python having this is a
 bit optimistic (but not entirely unrealistic; wxPython has stock binary
 packages to match the stock Python 2.4, 2.5 and 2.6, and supports
 concurrent installation of multiple versions of wxPython).

 > So lacking a way to locally set the extension association, our only
 choice is to ditch PATHEXT and use wrapper scripts which ensure that the
 GRASS_PYTHON enviro var. is respected.

 The obvious choice is to simply use the system Python, just like we do on
 Unix.

 It's not as if the user is overwhelmed by a choice of 20 different third-
 party Python packages. There are standard Windows (and MacOSX) binary
 packages available from the python.org website (without any of the
 licensing issues associated with relying upon !ActiveState, like was the
 case for Tcl/Tk).

 If the user wants to associate the .py extension with something which
 isn't compatible[*] with the stock Python, that's their problem. It's not
 like we support Unix systems where /bin/sh is csh, either.

 [*] It doesn't have to actually '''be''' the stock Python, but it does
 need to provide the same language with the same modules. Scripts don't
 need binary compatibility.

 > > but any standalone scripts will use the system Python
 > > installation, and GRASS shouldn't be interfering with that
 >
 > is there anything left which won't use the python set by the
 GRASS_PYTHON enviro variable? (from #570 apparently the answer is yes)

 Running a .py script from the command line or via the Windows shell (i.e.
 via !ShellExecute, which includes {{{subprocess.Popen(..., shell =
 True)}}}) won't use GRASS_PYTHON, nor should it. Even within a GRASS
 session, the command line should be able to run non-GRASS commands,
 including those written in Python.

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 hamish):

 Replying to [comment:7 cmbarton]:
 > Given all this, is there a way to run a Python script in GRASS for
 > Windows now (i.e., by including some code in the script or its
 > batch file) or will it have to wait until the GRASS code is
 > changed?

 I think the answer is yes, there is a way. This bug report is mostly
 worried about add-on scripts in $GISBASE/etc/gui/scripts being called from
 the GUI. You will have to experiment from the command line to test local
 g.parser scripts or those in GRASS_ADDON_DIR; please let us know results!


 Hamish

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 cmbarton):

 So far nothing works. We did up the Python script the way it is suggested
 in the WIKI and it works fine on Linux and Mac. It either does nothing or
 hangs before launching on Windows. The farthest we've gotten is to get the
 error that the script does not generate an XML interface-description. My
 interpretation is that python parser work on Linux and Mac but not on
 Windows from the command line.

 Michael

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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:10 cmbarton]:
 > So far nothing works. We did up the Python script the way it is
 suggested in the WIKI and it works fine on Linux and Mac. It either does
 nothing or hangs before launching on Windows. The farthest we've gotten is
 to get the error that the script does not generate an XML interface-
 description. My interpretation is that python parser work on Linux and Mac
 but not on Windows from the command line.

 On Windows, 6.4's g.parser explicitly invokes the script via $GRASS_SH.
 Obviously this won't work for Python scripts.

 FWIW, Python scripts work in Windows in 7.0, whether the script is in the
 path or not (once PYTHONPATH has been set; Init.bat doesn't set this).

 The biggest difference between the two is that in 7.0, the
 grass.script.parser() Python function uses "g.parser -s", which eliminates
 the need to re-execute the script. It may be worth back-porting this
 feature to 6.x (the existing behaviour is still available for use by shell
 scripts).

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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 cmbarton):

 Replying to [comment:11 glynn]:
 > Replying to [comment:10 cmbarton]:
 > > So far nothing works. We did up the Python script the way it is
 suggested in the WIKI and it works fine on Linux and Mac. It either does
 nothing or hangs before launching on Windows. The farthest we've gotten is
 to get the error that the script does not generate an XML interface-
 description. My interpretation is that python parser work on Linux and Mac
 but not on Windows from the command line.
 >
 > On Windows, 6.4's g.parser explicitly invokes the script via $GRASS_SH.
 Obviously this won't work for Python scripts.

 Does this mean that it is only expecting shell scripts in Windows? What
 happens on other platforms (since Python does run without problems in
 Linux and on Mac)?

 >
 > FWIW, Python scripts work in Windows in 7.0, whether the script is in
 the path or not (once PYTHONPATH has been set; Init.bat doesn't set this).
 >
 > The biggest difference between the two is that in 7.0, the
 grass.script.parser() Python function uses "g.parser -s", which eliminates
 the need to re-execute the script. It may be worth back-porting this
 feature to 6.x (the existing behaviour is still available for use by shell
 scripts).

 Seems like that would be a very good idea, if it means that you can run
 something besides shell scripts in a Windows environment.

 Michael

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
GRASS GIS

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by GRASS GIS
#580: WinGRASS: $GISBASE/etc/gui/scripts/ require something like $(EXE) to run
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  [hidden email]
      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:12 cmbarton]:

 > > On Windows, 6.4's g.parser explicitly invokes the script via
 $GRASS_SH. Obviously this won't work for Python scripts.
 >
 > Does this mean that it is only expecting shell scripts in Windows?

 Yes. Windows doesn't understand shebang lines, so g.parser can't "run" the
 shell scripts as if they were executables; it has to use "$GRASS_SH
 <script>".

 It might be possible to use "$GRASS_SH -c <script>", as MSys' bash
 understands shebang lines. OTOH, for "#!/usr/bin/env python", this will
 only work if there is an executable named "python" in the path (if it's
 called e.g. "python25" or it isn't in the path, you lose).

 Alternatively, the scripts could be installed with a ".sh" extension,
 relying upon the file associations to run such scripts via bash.

 Or you could make g.parser examine the first line of the script and choose
 a suitable interpreter (it isn't as simple as processing a shebang on Unix
 as we don't know where MSys' virtual filesystem is located and we can't
 assume that the "#!/usr/bin/env" trick will work with "native"
 interpreters).

 > What happens on other platforms (since Python does run without problems
 in Linux and on Mac)?

 The code to re-invoke the script is conditionalised upon "#ifdef
 !__MINGW32!__". Unix (including MacOSX) simply execl()s the script
 directly, while the Windows version invokes it via $GRASS_SH.

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

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev