[GRASS-dev] Fwd: [GRASS-user] How to embed a grass script (for example v.db.addcol) into a Pythonscript on windows?

Michael Barton Michael.Barton at asu.edu
Thu Mar 18 11:26:30 EDT 2010


Thanks. Will try this.

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity 
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 	480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax:          480-965-7671 SHESC),  480-727-0709 (CSDC)
www: www.public.asu.edu/~cmbarton, http://csdc.asu.edu









On Mar 18, 2010, at 4:03 AM, Glynn Clements wrote:

> 
> Michael Barton wrote:
> 
>> A couple of students are trying to run python in wingrass now, following
>> your directions below. They installed python, but we're not sure where
>> to put #4 in your steps.
>> 
>>>> 4. PYTHONPATH needs to be set to %WINGISBASE%\etc\python
>> 
>> 
>> It seems like it ought to go into the "grass64svn" initialization file
>> 
>> That file has the following lines...
>> 
>> PYTHONPATH="$GISBASE/etc/python:$GISBASE/Python25:$PYTHONPATH"
>> export PYTHONPATH
>> PYTHONHOME="C:\Program Files\GRASS-64-SVN\Python25"
>> 
>> Does it go there? With quotes? What about changing PYTHONHOME?
> 
> PYTHONPATH should be in Windows format. I don't know whether MSys will
> convert it or not, but I wouldn't rely upon it.
> 
> PYTHONHOME shouldn't need to be set provided that Python was installed
> correctly (i.e. using the .msi file from python.org). If you're doing
> something else (e.g. trying to use a version of Python "bundled" with
> GRASS), then I haven't got a clue.
> 
> FWIW, the following batch file works fine for me, with GRASS built
> from source and installed with "make install" (i.e. no "installer" or
> modifications to the startup files):
> 
> set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\GnuWin32\bin;C:\msys\1.0\local\bin;C:\Program Files\Python25
> set GRASS_PYTHON=C:\Program Files\Python25\python.exe
> set GRASS_WISH=wish84
> set GRASS_SH=C:\msys\1.0\bin\sh.exe
> "C:\Program Files\GRASS-6.5svn\grass65.bat" -text
> 
> Note: -text can be replaced with -tcltk or -wxpython; all work.
> 
> However, within GRASS, I also need:
> 
> set PYTHONPATH=%WINGISBASE%\etc\python
> 
> as init.bat only sets this if you start with -wxpython.
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>



More information about the grass-dev mailing list