[GRASS-dev] Re: [GRASS-windows] compiling WINGrass Python Scripts - ExpatError

Hi,

-------- Original-Nachricht --------

Datum: Wed, 7 Dec 2011 21:23:13 +0000
Von: Glynn Clements <glynn@gclements.plus.com>
An: Johannes Radinger <JRadinger@gmx.at>
CC: grass-dev@lists.osgeo.org, grass-windows@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 just meant that it comes already with GRASS so that I can be sure
that the source of the error is not my own script!

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

Where do I have to set this permanently in Windows? Do I have modify a certain file? I'd need to use also my system python (2.6) and its modules within the script - will there be conflict?

Although the combination GRASS 6.x, Windows and Python isn't well tested I want to give it a try - as a tester....:slight_smile:

/johannes

> 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@gclements.plus.com>

--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone

Where do I have to set this permanently in Windows? Do I have modify a

certain file?

have a look in C:\Program Files (x86)\GRASS 6.4.SVN\etc\env.bat

Helmut

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/compiling-WINGrass-Python-Scripts-ExpatError-tp7062790p7074085.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Johannes Radinger wrote:

> You need:
>
> set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%
>
> 7.0 does this automatically, but 6.x doesn't.

Where do I have to set this permanently in Windows? Do I have modify
a certain file? I'd need to use also my system python (2.6) and its
modules within the script - will there be conflict?

I suspect that GRASS' Init.bat or env.bat files are the appropriate
place. There's no reason to set it system-wide (i.e. outside of
GRASS).

--
Glynn Clements <glynn@gclements.plus.com>

On Thu, 08 Dec 2011 13:03:36 +0100
"Johannes Radinger" <JRadinger@gmx.at> wrote:

Hi,
> Glynn Clements <glynn@gclements.plus.com> escribió:

> 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 just meant that it comes already with GRASS so that I can be sure
that the source of the error is not my own script!

Hi Johannes, list,

as Glynn said, the module is quite different from other GRASS modules,
as it has its own GUI and calls another software (R) in the background.
It was built as a proof of concept, and many details are very
experimental. After integration in core I wasn't able to continue
development with the same pace, but I plan to.

all the best,
Anne
--
http://gis.cri.fmach.it/ghisla/