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

Glynn Clements glynn at gclements.plus.com
Thu Apr 1 16:54:55 EDT 2010


Michael Barton wrote:

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

By "MSys GRASS prompt", are you talking about running MSys' /bin/sh in
a Windows console, or in MSys' (broken and deprecated) rxvt program?

Note that Windows versions of Python won't exhibit "interactive"
behaviour (prompt, input editing) within rxvt, because it isn't a tty
according to MSVCRT's isatty() function.

If you're using rxvt, you're on your own. Even using /bin/sh may be an
issue due to the conversions between Windows and MSys filename
formats.

The batch file which I posted results in a GRASS session using cmd.exe
within a Windows console.

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

I can only tell you what works for me, namely using native Windows
versions in preference to MSys, using GnuWin32 libraries in preference
to MSys, not using anything from OSGeo4W (except possibly GDAL), not
using the Windows "packaging" in the GRASS source tree, etc. Just
configure, make, make install, then a batch file to set a few
essential environment variables before starting grass65.bat.

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


More information about the grass-dev mailing list