Opened 11 years ago
Closed 11 years ago
#2138 closed defect (fixed)
winGRASS6.4.svn - addon python script status?
Reported by: | hellik | Owned by: | martinl |
---|---|---|---|
Priority: | critical | Milestone: | 6.4.4 |
Component: | Addons | Version: | svn-releasebranch64 |
Keywords: | wingrass, addon, python | Cc: | grass-dev@… |
CPU: | x86-64 | Platform: | MSWindows 7 |
Description
regarding 6.4.4 planning http://lists.osgeo.org/pipermail/grass-dev/2013-November/066351.html
some tests for addon python scripts:
System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 58275 GIS Library Revision: 50937 (2012-02-25) GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
structure of the addon-folder in winGRASS6.4.svn:
bin <= python script related bat-files are here docs man modules.xml r.basin.py r.ipso.py r.stream.angle.exe r.stream.basins.exe r.stream.del.exe r.stream.distance.exe r.stream.extract.exe r.stream.order.exe r.stream.pos.exe r.stream.stats.exe r.wf.py
the python script related bat-files are here are in the bin-folder, but the addon\bin isn't in the %GRASS_ADDON_PATH%
the content of r.basin.py.bat:
@"%GRASS_SH%" "%GISBASE%/scripts/r.basin.py" %*
%GRASS_SH% can't start python scripts.
so python script aren't working with winGRASS6.4.SVN
now testing with winGRASS6.5.svn
System Info GRASS Version: 6.5.svn GRASS SVN Revision: 58286 GIS Library Revision: 50936 (2012-02-25) GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
Fetch & install extension from GRASS Addons
structure of the addon-folder in winGRASS6.5.svn:
bin <= empty docs etc man modules.xml r.basin.bat <= r.basin.py <= r.ipso.bat r.ipso.py r.stream.angle.exe r.stream.basins.exe r.stream.del.exe r.stream.distance.exe r.stream.extract.exe r.stream.order.exe r.stream.pos.exe r.stream.preview.bat r.stream.preview.py r.stream.stats.exe r.wf.bat r.wf.py scripts
in the wxgui-commandline r.basin can be choosen, but
Traceback (most recent call last): File "C:\OSGEO4~1\apps\grass\grass-6.5.svn\etc\wxpython\gu i_core\prompt.py", line 839, in OnItemSelected self.cmdDesc = gtask.parse_interface(GetRealCmd(cmd)) File "C:\OSGEO4~1\apps\grass\grass-6.5.svn\etc\python\gras s\script\task.py", line 470, in parse_interface tree = etree.fromstring(get_interface_description(name)) File "C:\OSGEO4~1\apps\grass\grass-6.5.svn\etc\python\gras s\script\task.py", line 448, in get_interface_description "\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' : decode(cmderr) } grass.script.core . ScriptError : Unable to fetch interface description for command 'r.basin.bat'. Details: C:\OSGEO4~1\bin\python.exe: can't open file 'C:/OSGEO4~1/apps/grass/grass-6.5.svn/r.basin.py': [Errno 2] No such file or directory
content of r.basin.bat:
@"%GRASS_PYTHON%" "%GISBASE%/r.basin.py" %*
addon-path isn't within the related bat-file, it searches in %GISBASE%
with following changes
r.basin.bat @"%GRASS_PYTHON%" "%GRASS_ADDON_PATH%/r.basin.py" %*
r.basin-gui can be invoked, but running the script by 'run' in the r.basin-wxgui raises following error
r.basin.py --verbose map=elevation@PERMANENT prefix=oh easting=636654.791181 northing=218824.126649 threshold=20 C:\OSGEO4~1\bin\python.exe: can't open file 'r.basin.py': [Errno 2] No such file or directory (Sun Nov 24 15:47:59 2013) Befehl ausgeführt (0 Sek)
but starting within the wxgui-commandline
r.basin --verbose map=elevation@PERMANENT prefix=oh easting=636654.791181 northing=218824.126649 threshold=20 ABSCHNITT 1a (von 4): Initiiere den Speicher. ABSCHNITT 1b (of 4): Ermittle den Fluß aus der Karte heraus. ABSCHNITT 2: A * Suche. [...]
the script (which invokes two other python scripts) finishes now.
the winGRASS6.5.svn-approach/status regarding python addon-scripts is much better than winGRASS6.4.svn-approach/status
what is missing for downgrading ticket?
- change in the bat-file for the python script %GISBASE%/xyz.py to %GRASS_ADDON_PATH%/xyz.py
- run the script by the run-button in the script-wxgui should work
Change History (33)
follow-up: 11 comment:1 by , 11 years ago
follow-ups: 3 4 comment:2 by , 11 years ago
Version: | unspecified → svn-releasebranch64 |
---|
see also #1768 and commit log message for r58199.
fwiw r.threshold.py from 6.5 addons was what I've been using for a test case.
r58199 is the change 2 weeks ago to g.extension.py in devbr6 which makes things a bit better by manually editing the wrapper .bat file to run %GRASS_PYTHON% instead of sh.exe. It's just a hack though, and trades python scripts working from the bash command line for them working in the wxGUI command line (on Wingrass). For Wingrass I suspect the wxGUI might be the more important one for the majority of users, but it makes me sad to choose between them, better we should make it work from everywhere. Since it (in part) trades one half-solution for another & I'm not happy with the foundation it lays, I didn't backport it yet. But I guess a partially working hack is better than known breakage, so it could be backported.
with r58199 %GISBASE% -> %GRASS_ADDON_PATH% happens just before the SH -> PYTHON on line 637.
I'm a little bit lost in g.extension.py to change the path to addons correctly also for addon python script ...
do you need a change beyond what is in 6.5's g.extension.py? i.e. that a backport wouldn't solve?
AFAIK the .py extension association on Windows is the main problem, getting that to work so you don't need to add the .bat extension to run the module, and for the second pass it knows that $0 has an assumed .py extension not an explicit one.
What we really need is an include/Make/PythonScript.make, I didn't get very far with it beyond a minor edit to Script.make:
--- Script.make 2013-06-25 14:46:53.452338241 +1200 +++ PythonScript.make 2013-06-25 14:19:50.224336291 +1200 @@ -19,7 +19,7 @@ $(SCRIPT): $(PGM) if [ ! -d $(SCRIPTDIR) ]; then $(MKDIR) $(SCRIPTDIR); fi - $(INSTALL) $(PGM) $(SCRIPT) + $(INSTALL) $(PGM).py $(SCRIPT) $(MAKE) htmlscript scriptstrings $(MAKE) mancmd
It won't solve the association problem, but it will reduce the current pile of hacks into a single clean place.
To be honest, my main concern isn't reall the downloadable Python addons on WinGrass, since we can do a lot to fix that post-release as part of the nightly builds, I'm much more concerned about custom user-composed Python addon modules on Wingrass - that support has to be working out of the box - it's a really important thing to have personal Python scripts working for Windows users!
regards, Hamish (still ~90% AFK these weeks)
comment:3 by , 11 years ago
Replying to hamish:
It's just a hack though, and trades python scripts working from the bash command line for them working in the wxGUI command line (on Wingrass).
by that I mean the overall commit, not the change from SH -> PYTHON. The working one place but not the other trouble has to do with adding .py in the wrapper .bat file & Window's extension associations IIRC.
H
follow-up: 5 comment:4 by , 11 years ago
tested with
System Info GRASS Version: 6.5.svn GRASS SVN Revision: 58316 GIS Library Revision: 50936 (2012-02-25) GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
Replying to hamish:
with r58199 %GISBASE% -> %GRASS_ADDON_PATH% happens just before the SH -> PYTHON on line 637.
I see it, but addons installed with Fetch & install extensions from grass addons
r.threshold.bat @"%GRASS_PYTHON%" "%GISBASE%/r.threshold.py" %*
r.basin.bat @"%GRASS_PYTHON%" "%GISBASE%/r.basin.py" %*
comment:5 by , 11 years ago
Replying to hellik:
with r58199 %GISBASE% -> %GRASS_ADDON_PATH% happens just before the SH -> PYTHON on line 637.
I see it, but addons installed with Fetch & install extensions from grass addons
r.threshold.bat @"%GRASS_PYTHON%" "%GISBASE%/r.threshold.py" %*r.basin.bat @"%GRASS_PYTHON%" "%GISBASE%/r.basin.py" %*
the same bat-file-content when installed by
g.extension.py extension=r.threshold operation=add g.extension.py extension=r.basin operation=add
follow-up: 7 comment:6 by , 11 years ago
Should r58199 be backported? Did anyone test winGRASS 6.5.svn?
follow-up: 8 comment:7 by , 11 years ago
follow-up: 9 comment:8 by , 11 years ago
follow-up: 10 comment:9 by , 11 years ago
comment:10 by , 11 years ago
sorry for the late response, I'm travelling ....
Replying to neteler:
Replying to neteler:
OK, backported in r58680. So to be tested in (win)GRASS 6.4.svn.
Does it now work in 6.4.svn?
just a quick test
System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59095 GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-7-6.1.7601-SP1 (OSGeo4W)
g.extension.py extension=r.basin svnurl=http://svn.osgeo.org/grass/grass-addons/grass6 Downloading precompiled GRASS Addons <r.basin>... Updating metadata file... Installation of <r.basin> successfully finished (Fri Feb 28 11:13:50 2014) Befehl ausgeführt (14 Sek)
r.basin.bat
@"%GRASS_PYTHON%" "%GISBASE%/r.basin.py" %*
see http://trac.osgeo.org/grass/ticket/2138?replyto=9#comment:4
there is still %GISBASE% instead of %GRASS_ADDON_PATH% in the related bat-file, altough it should be replaced
see line 637 of g.extension.py
line = line.replace("%GISBSASE%", options['prefix'])
any idea?
follow-up: 13 comment:11 by , 11 years ago
comment:12 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
follow-up: 14 comment:13 by , 11 years ago
Replying to martinl:
Replying to hellik:
I'm a little bit lost in g.extension.py to change the path to addons correctly also for addon python script ...
it was just a typo, should be fixed in r59750
right, the typo should be obvious ;-)
tested here with
System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59750 GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-Vista-6.0.6002-SP2 (OSGeo4W)
g.extension.py extension=r.flip svnurl=http://svn.osgeo.org/grass/grass-addons/grass6 Downloading precompiled GRASS Addons <r.flip>... Updating metadata file... Installation of <r.flip> successfully finished
the content of the related bat-file:
@"%GRASS_SH%" "%GRASS_ADDON_PATH%/r.flip" %*
and a python addon:
g.extension.py extension=r.basin svnurl=http://svn.osgeo.org/grass/grass-addons/grass6 Downloading precompiled GRASS Addons <r.basin>... Updating metadata file... Installation of <r.basin> successfully finished
the related bat-file:
@"%GRASS_PYTHON%" "C:\Users\xxx\AppData\Roaming\GRASS6\addons/r.basin.py" %*
the path for the python addon seems to be hard coded compared to a shell addon?
follow-up: 15 comment:14 by , 11 years ago
Replying to hellik:
the related bat-file:
@"%GRASS_PYTHON%" "C:\Users\xxx\AppData\Roaming\GRASS6\addons/r.basin.py" %*the path for the python addon seems to be hard coded compared to a shell addon?
GRASS_ADDON_PATH
could contain more directory paths. From this POV the hardcoded path is probably better. It also relates for prefix
option of g.extension
.
follow-ups: 16 17 comment:15 by , 11 years ago
Priority: | blocker → critical |
---|
Replying to martinl:
Replying to hellik:
the related bat-file:
@"%GRASS_PYTHON%" "C:\Users\xxx\AppData\Roaming\GRASS6\addons/r.basin.py" %*the path for the python addon seems to be hard coded compared to a shell addon?
GRASS_ADDON_PATH
could contain more directory paths. From this POV the hardcoded path is probably better. It also relates forprefix
option ofg.extension
.
it's just interesting why the same string exchange mechanism in g.extension.py does different things for shell and python addon scripts regarding path.
anyway downgrading priority; one step further to GRASS6.4.4 RC1.
follow-up: 18 comment:16 by , 11 years ago
Replying to hellik:
it's just interesting why the same string exchange mechanism in g.extension.py does different things for shell and python addon scripts regarding path.
anyway downgrading priority; one step further to GRASS6.4.4 RC1.
you are right, it's inconsistency, GRASS_ADDONS_PATH for bash scripts probably comes from build system (GRASS 6 supports only Bash scripts). I have changed g.extension.py
in r59764 and r59765 to behave similarly also for Python scrips.
comment:17 by , 11 years ago
follow-ups: 19 20 comment:18 by , 11 years ago
Replying to martinl:
Replying to hellik:
it's just interesting why the same string exchange mechanism in g.extension.py does different things for shell and python addon scripts regarding path.
anyway downgrading priority; one step further to GRASS6.4.4 RC1.
you are right, it's inconsistency, GRASS_ADDONS_PATH for bash scripts probably comes from build system (GRASS 6 supports only Bash scripts). I have changed
g.extension.py
in r59764 and r59765 to behave similarly also for Python scrips.
for the record I've closed #1768 as duplication of #1768. will close this ticket after testing the upcoming nightly.
comment:19 by , 11 years ago
follow-up: 21 comment:20 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to hellik:
for the record I've closed #1768 as duplication of #1768. will close this ticket after testing the upcoming nightly.
tested with
(Fri Apr 18 09:37:14 2014) Befehl ausgeführt (2 Sek) System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59777 GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-Vista-6.0.6002-SP2 (OSGeo4W)
the content of the related bat-file
@"%GRASS_PYTHON%" "%GRASS_ADDON_PATH%/r.basin.py" %*
closing ticket
follow-up: 22 comment:21 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Replying to hellik:
Replying to hellik:
for the record I've closed #1768 as duplication of #1768. will close this ticket after testing the upcoming nightly.
tested with
(Fri Apr 18 09:37:14 2014) Befehl ausgeführt (2 Sek) System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59777 GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-Vista-6.0.6002-SP2 (OSGeo4W)the content of the related bat-file
@"%GRASS_PYTHON%" "%GRASS_ADDON_PATH%/r.basin.py" %*closing ticket
e.g. r.basin start by typing r.basin in the wxgui-commandline, then enter all parameters und press the start button in the r.basin-wxgui:
r.basin.py --verbose map=elevation@PERMANENT prefix=l easting=636654.791181 northing=218824.126649 threshold=20 C:\OSGeo4W\bin\python.exe: can't open file 'r.basin.py': [Errno 2] No such file or directory
but without the the py-extension, the addon script starts
r.basin --verbose map=elevation@PERMANENT prefix=l easting=636654.791181 northing=218824.126649 threshold=20 ABSCHNITT 1a (von 4): Initiiere den Speicher. ABSCHNITT 1b (of 4): Ermittle den Fluß aus der Karte heraus. ABSCHNITT 2: A * Suche.
any idea?
follow-ups: 23 24 25 comment:22 by , 11 years ago
Replying to hellik:
e.g. r.basin start by typing r.basin in the wxgui-commandline, then enter all parameters und press the start button in the r.basin-wxgui:
> r.basin.py --verbose map=elevation@PERMANENT prefix=l easting=636654.791181 northing=218824.126649 threshold=20
how you managed that? When I type to wxGUI console r.basin
, press Enter, fill all parameters and press Start button than the command is launched correctly (so without .py extension)
comment:23 by , 11 years ago
Replying to martinl:
how you managed that? When I type to wxGUI console
r.basin
, press Enter, fill all parameters and press Start button than the command is launched correctly (so without .py extension)
very strange ...
System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59777 GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-Vista-6.0.6002-SP2 (OSGeo4W)
can test it later on on my win7-box
(1) no addons in C:\Users\xxxx\AppData\Roaming\GRASS6
(2) fetch and install addons => ok
addons are now in C:\Users\xxxx\AppData\Roaming\GRASS6 => ok
(3) python addon script-related bat-files => ok
e.g.
@"%GRASS_PYTHON%" "%GRASS_ADDON_PATH%/r.basin.py" %*
(3)
wxGUI console r.basin
, press Enter => r.basin-wxgui pops up => ok
(4) fill all parameters and press Start button of r.basin-wxgui => r.basin-wxgui command output
r.basin.py map=elevation@PERMANENT prefix=n easting=636654.791181 northing=218824.126649 C:\OSGeo4W\bin\python.exe: can't open file 'r.basin.py': [Errno 2] No such file or directory (Fri Apr 18 14:11:31 2014) Befehl ausgeführt (0 Sek)
comment:24 by , 11 years ago
Replying to martinl:
Replying to hellik:
e.g. r.basin start by typing r.basin in the wxgui-commandline, then enter all parameters und press the start button in the r.basin-wxgui:
> r.basin.py --verbose map=elevation@PERMANENT prefix=l easting=636654.791181 northing=218824.126649 threshold=20how you managed that? When I type to wxGUI console
r.basin
, press Enter, fill all parameters and press Start button than the command is launched correctly (so without .py extension)
this was already in my original report (see also above):
r.basin-gui can be invoked, but running the script by 'run' in the r.basin-wxgui raises following error r.basin.py --verbose map=elevation@PERMANENT prefix=oh easting=636654.791181 northing=218824.126649 threshold=20 C:\OSGEO4~1\bin\python.exe: can't open file 'r.basin.py': [Errno 2] No such file or directory (Sun Nov 24 15:47:59 2013) Befehl ausgeführt (0 Sek)
AFAIR tested on different windows boxes (vista, 7, 8) with same results
any idea?
comment:25 by , 11 years ago
Replying to martinl:
Replying to hellik:
e.g. r.basin start by typing r.basin in the wxgui-commandline, then enter all parameters und press the start button in the r.basin-wxgui:
> r.basin.py --verbose map=elevation@PERMANENT prefix=l easting=636654.791181 northing=218824.126649 threshold=20how you managed that? When I type to wxGUI console
r.basin
, press Enter, fill all parameters and press Start button than the command is launched correctly (so without .py extension)
follow-up: 27 comment:26 by , 11 years ago
sorry trac does log out always after a few seconds: should be
now tested with standalone
System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59777 GDAL/OGR: GDAL 1.10.1, released 2013/08/26 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-Vista-6.0.6002-SP2
the r.basin-wxgui pops up, enter all parameters and press start button
r.basin.py map=elevation@PERMANENT prefix=j easting=636654.791181 northing=218824.126649 threshold=20 C:\Program Files\GRASS GIS 6.4.4svn\extrabin\python.exe: can't open file 'r.basin.py': [Errno 2] No such file or directory (Fri Apr 18 14:41:55 2014) Befehl ausgeführt (0 Sek)
follow-up: 31 comment:27 by , 11 years ago
follow-up: 29 comment:28 by , 11 years ago
To be honest I would not expect that r.basin.py
would work. It should be enough that r.basin
works. The name of the module is r.basin
and only this will work for all platforms, so I don't think it would be beneficial if some people would write r.basin
and some r.basin.py
.
comment:29 by , 11 years ago
Replying to wenzeslaus:
To be honest I would not expect that
r.basin.py
would work. It should be enough thatr.basin
works. The name of the module isr.basin
and only this will work for all platforms, so I don't think it would be beneficial if some people would writer.basin
and somer.basin.py
.
The problem was that if you launched the command from the dialog (fill parameter and press Start button) than it was calling r.basin.py
instead of r.basin
. It should be fixed now.
comment:30 by , 11 years ago
In r59799 I fixed bug when install exe addons. So please test the next build which should allow to install and launch py/sh/exe addons.
follow-up: 32 comment:31 by , 11 years ago
Replying to martinl:
Replying to hellik:
the r.basin-wxgui pops up, enter all parameters and press start button
> r.basin.py map=elevation@PERMANENT prefix=j easting=636654.791181 northing=218824.126649 threshold=20you are right, please try the next build - see r59782
tested with
System Info GRASS Version: 6.4.4svn GRASS SVN Revision: 59785 GDAL/OGR: 1.10.1 PROJ4: Rel. 4.8.0, 6 March 2012 Python: 2.7.4 wxPython: 2.8.12.1 Platform: Windows-Vista-6.0.6002-SP2 (OSGeo4W)
it works now, thanks for fixing it.
comment:32 by , 11 years ago
Replying to hellik:
it works now, thanks for fixing it.
confirmed, I tested the latest build and it's possible to install and launch all types of addons (exe/sh/py). Time to close this ticket?
comment:33 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
in comparison additional information related to shell scripts
i.e. http://trac.osgeo.org/grass/browser/grass-addons/grass6/vector/v.out.ascii.mat
the content of v.out.ascii.mat.bat
see "%GISBASE%/r.basin.py" vs. "%GRASS_ADDON_PATH%/v.out.ascii.mat"
it seems for addon shell scripts the path is correct.
I'm a little bit lost in g.extension.py to change the path to addons correctly also for addon python script ...