[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
Sun Apr 11 03:47:35 EDT 2010


Michael Barton wrote:

> We tried starting GRASS in a dos window rather than msys using the
> command line option. This was a big improvement. We can run basic python
> scripts and start an interactive python session. So now we move on to
> new issues about running scripts.
> 
> 1) scripts that call subprocess for some reason try to import threading
> which tries to import "collection". Collection does not exist. Very
> bizarre. Could this be a parser issue?

Either the Python installation is broken or the variables are
misconfigured. Pointing PYTHONHOME at a version other than the one
with which the .py extension is associated will do this.

In 2.5, the collections module is built into the interpreter; in 2.6,
it's a separate file (Lib\collections.py).

> 2) scripts that attempt to import the grass_script library cannot find
> it. Somehow this needs to get into the path/pythonpath at startup.
> $GISBASE/etc/python

This may have to be done manually. AFAICT, the 6.x init.bat file only
sets PYTHONPATH if you start GRASS with the -wxpython switch.

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


More information about the grass-dev mailing list