[GRASS-user] Problem with running Python script in GRASS

Luigi Ponti lponti at inbox.com
Fri May 7 07:09:41 EDT 2010


Dear Glynn,

I am always interested in GRASS scripting-related questions. Thanks for 
your support on Python/Windows issues.

> From: Glynn Clements <glynn at gclements.plus.com>
> Subject: Re: [GRASS-user] Problem with running Python script in GRASS
> To: LeeDaniel <Lee.Daniel.1986 at gmail.com>
> Cc: grass-user at lists.osgeo.org
> Message-ID: <19426.59411.559013.36727 at cerise.gclements.plus.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> LeeDaniel wrote:
>
>   
>> > I've written a Python script, doing my best to use the Python I know and
>> > reverse engineer the python scripts I found in the Internet. As far as I can
>> > tell, the script should be fine, although I naturally can't execute it
>> > independently. [...]
>
> Windows, Python and 6.4 isn't the most reliable combination.
>
> At a minimum, you need a fairly recent version of 6.5 to be able to
> use Python scripts on Windows (the hacks required to get shell scripts
> to work on Windows get in the way of running other scripts). 6.4.0-RC6
> won't work (g.parser was updated, but lib/python wasn't).
>   

Is this true also for the daily WinGRASS-6.4.SVN at 
http://josef.fsv.cvut.cz/wingrass/ and will this hold true for 6.4 in 
general?

> You also need a "clean" Python install with the correct registry
> entries, 
 From what you say, one needs two Python installations: the one that 
comes with GRASS and an additional "fresh" one -- is it ok to install 
the current Python 2.6.5 version or 2.5 is better (2.6 seems to be ok 
from http://grass.osgeo.org/wiki/GRASS_and_Python)? From the 
GRASS/Python wiki one also infers that on Windows the Python binaries 
that come with the GRASS installation are no longer used (?).

(Currently I am using WinGRASS-6.4.SVN-r42046-1 from the installer 
downloaded at the link above; OS is windows 7.)

> and you may need to hack the GRASS startup scripts (the
> WinGRASS installer fails quite badly with regard to Python, and the
> OSGeo4W installer fails even harder).
>   

But my question is actually: if a user wants to take a (Windows) Python 
scripting approach to GRASS, what version should she/he target? My 
impression is that trying to build functionality using GRASS 7 may have 
the best returns, although I am not sure how feasible is that right now, 
i.e. what GRASS 6 functionality can currently be ported to GRASS 6 (I am 
thinking for example to a way around the display issue that in 6.4 is 
solved using appropriate settings for e.g. GRASS_RENDER_IMMEDIATE).

Given that WinGRASS users have the extreme luxury of 7.0.svn snapshot 
installers being built almost daily thanks to Martin Landa:
http://josef.fsv.cvut.cz/wingrass/grass70/

it would be very interesting to know your opinion.

Kind regards and thank you in advance,

Luigi

> -- Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100507/86df87c3/attachment.html


More information about the grass-user mailing list