[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
Wed Mar 31 14:39:38 EDT 2010
Hi Glynn,
We've tried the things below and are not getting anywhere. I don't know if we simply don't understand something (I'm not a Windows person, but the 2 students copied are) or there is something more we need to do.
So far, we've installed Python from python.org. We've installed it where it normally goes (at the C:\ root) and tried it in Programs.
We've substituted your batch file below for the one that comes with GRASS 6.4 svn for Windows.
After doing this and trying to run python at the MSys GRASS prompt, it simply comes back to a blank line, as if waiting for something. No Python shell. Is this the wrong way to test this?
If GRASS Python is working for you, we must be close. But I simply don't know how to proceed. Any advice would be welcome.
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