[Osgeo4w-trac] [osgeo4w] #96: "import grass.script as grass" in
Python GRASS AddOns doesn't work
OSGeo4W
trac_osgeo4w at osgeo.org
Tue Jul 7 08:00:36 EDT 2009
#96: "import grass.script as grass" in Python GRASS AddOns doesn't work
--------------------+-------------------------------------------------------
Reporter: aghisla | Owner: osgeo4w-dev at lists.osgeo.org
Type: defect | Status: new
Priority: major | Component: Package
Version: | Keywords: grass addon python grass.script
--------------------+-------------------------------------------------------
I'm trying to run a Python AddOn in OSGeo4W GRASS. There are some problems
in getting grass-python module work.
1. Native install: [[BR]]
* GRASS 6.4.0svn2 [[BR]]
* bundled Python
{{{
Welcome to GRASS 6.4.0svn (2009)
Microsoft Windows XP [Versione 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
GRASS 6.4.0svn (spearfish60)> python C:\v.krige\v.krige.py
Traceback (most recent call last):
File "C:\v.krige\v.krige.py", line 54, in <module>
import grass.script as grass
ImportError: No module named script
}}}
2. Modified install: [[BR]]
* as above [[BR]]
* python folder in C:\OSGeo4W\apps\grass\grass-6.4.0svn\etc\ substituted
with the python folder in grass6_develbranch, rev 38064
{{{
GRASS 6.4.0svn (spearfish60)> python C:\v.krige\v.krige.py
Traceback (most recent call last):
File "C:\v.krige\v.krige.py", line 54, in <module>
import grass.script as grass
ImportError: No module named grass.script
GRASS 6.4.0svn (spearfish60)> python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on
win32
>>> import core as grass
>>> grass.run_command("g.list", type="vect")
----------------------------------------------
vector files available in mapset <PERMANENT>:
archsites roads t_9961_200 t_9961_500
t_roads_prime
...
}}}
so bundled Python can actually import the module, but not as grass.script.
There's something I'm missing, but hope this report helps.
BTW, there is a similar ticket (#95) but about QGIS and not on the same
issue, but also about grass module.
--
Ticket URL: <http://trac.osgeo.org/osgeo4w/ticket/96>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer for the OSGeo stack.
More information about the Osgeo4w-trac
mailing list