[GRASS-windows] compiling WINGrass Python Scripts - ExpatError
Johannes Radinger
JRadinger at gmx.at
Tue Dec 13 10:42:34 EST 2011
Hello,
I tried no to put 'set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%'
into the env.bat file of my selfcompiled GRASS6.5SVN on Windows.
Anyway it took me a while to get the 'real' correct line I think (as mentioned in the wiki)
In the env.bat file (C:\\OSGeo4W\apps\grass\grass-6.5.svn\etc\env.bat)
there are now following lines:
set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass-6.5.svn
set GRASS_SH=%OSGEO4W_ROOT%\apps\msys\bin\sh.exe
set GRASS_WISH=%OSGEO4W_ROOT%\bin\wish.exe
set GRASS_PYTHON=%OSGEO4W_ROOT%\bin\python.exe
set GRASS_PROJSHARE=%OSGEO4W_ROOT%\share\proj
set GRASS_HTML_BROWSER=explorer
set PATH=%OSGEO4W_ROOT%\apps\grass\grass-6.5.svn\bin;%OSGEO4W_ROOT%\apps\grass\grass-6.5.svn\lib;%PATH%
set PYTHONPATH=%OSGEO4W_ROOT%\apps\Python25;%PYTHONPATH%
is that correct so far???
It seems that now a least the grass.script is found...but I still get
an erro when I want to call a python module/add on/script (with --help) from the GRASS commands console in the GRASS GUI:
(Tue Dec 13 15:36:48 2011)
pythontest_l --help
Traceback (most recent call last):
File "C:\OSGeo4W\apps\grass\grass-6.5.svn\scripts\pythonte
st_l.py", line 42, in <module>
import grass.script as grass
File "c:\OSGeo4W\apps\grass\grass-6.5.svn\etc\python\grass
\script\__init__.py", line 1, in <module>
from core import *
File "c:\OSGeo4W\apps\grass\grass-6.5.svn\etc\python\grass
\script\core.py", line 31, in <module>
import subprocess
File "C:\OSGeo4W\apps\Python25\lib\subprocess.py", line
376, in <module>
import threading
File "C:\OSGeo4W\apps\Python25\lib\threading.py", line 13,
in <module>
from collections import deque
ImportError: No module named collections
(Tue Dec 13 15:36:48 2011) Command finished (0 sec)
Is there anything more I can check? It seems that grass.script needs
a via subprocess a module called collections which isn't included in the python25 from the osgeo4w framework... do I understand that error correctly?
Just another question: Is it possible to use also my "own" python windows installation. Like I want to call my own add-on/script which includes g.parser and is compiled with the source. This script needs to load other pyhton modules which don't come with the osgeo-python. I script of this type is working on my Mac without any problems...hopefully it will also work on windows...
Thank you,
Johannes
-------- Original-Nachricht --------
> Datum: Wed, 7 Dec 2011 21:23:13 +0000
> Von: Glynn Clements <glynn at gclements.plus.com>
> An: Johannes Radinger <JRadinger at gmx.at>
> CC: grass-dev at lists.osgeo.org, grass-windows at lists.osgeo.org
> Betreff: Re: [GRASS-windows] compiling WINGrass Python Scripts - ExpatError
>
> Johannes Radinger wrote:
>
> > I tried to run the script now manually with --help
> > from the command line. For simplicicity I only tried
> > v.krige.py, a python script that already comes with
> > the GRASS 6.5 SVN install.
>
> v.krige.py isn't a normal Python script; it has its own GUI.
>
> > I also tried to run my own script without the .py ending and with
> --help:
> > '''''''''''''''''''''''''''''''''''''''
> > pythontest_l --help
> > Traceback (most recent call last):
> > File "C:\OSGeo4W\apps\grass\grass-6.5.svn\scripts\pythonte
> > st_l.py", line 42, in <module>
> > import grass.script as grass
> > ImportError: No module named grass.script
> > '''''''''''''''''''''''''''''''''''''''
>
> You need:
>
> set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%
>
> 7.0 does this automatically, but 6.x doesn't.
>
> > What is the normal way to run a python script in windows, with or
> > without the .py ending?
>
> I don't know. GRASS 6.x, Windows, and Python isn't a particularly
> well-tested combination.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
More information about the grass-windows
mailing list