[GRASS-dev] GRASS6.4 Ptyhon scripts- module
Glynn Clements
glynn at gclements.plus.com
Mon Jun 21 12:42:12 EDT 2010
António Rocha wrote:
> I was developing a special import script (for a designated dataset) and
> I used r.in.aster Python Script (GRASS7) as a based for this Python
> script in GRASS6.4.. It compiled but I got this error:
>
> make: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
> if [ ! -d /usr/local/grass-6.4.0svn/scripts ]; then mkdir -p
> /usr/local/grass-6.4.0svn/scripts; fi
> /usr/bin/install -c r.in.globcover.py
> /usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
> make htmlscript scriptstrings
> make[1]: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
> make /usr/local/grass-6.4.0svn/docs/html/r.in.globcover.py.html
> HTMLSRC=/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
> make[2]: Entering directory `/home/anrr/Desktop/dwe_devep/r.in.globcover.py'
> if [ "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py" != "" ] ;
> then GISRC=/usr/local/grass-6.4.0svn/demolocation/grassrc64
> GISBASE=/usr/local/grass-6.4.0svn
> PATH="/usr/local/grass-6.4.0svn/bin:$PATH"
> LD_LIBRARY_PATH="/usr/local/grass-6.4.0svn/bin:/usr/local/grass-6.4.0svn/lib:"
> LC_ALL=C /usr/local/grass-6.4.0svn/scripts/r.in.globcover.py
> --html-description < /dev/null | grep -v '</body>\|</html>' >
> r.in.globcover.py.tmp.html ; true ; fi
> Traceback (most recent call last):
> File "/usr/local/grass-6.4.0svn/scripts/r.in.globcover.py", line 50,
> in <module>
> import grass.script as grass
> *ImportError: No module named grass.script*
>
> I thought GRASS6.4 Python's script already had this module. Is not
> available?
6.4 has the Python modules, but the build system doesn't support
Python scripts (it doesn't set PYTHONPATH when executing commands).
You will need to modify the definition of htmldesc in
include/Make/Html.make to set PYTHONPATH to include
$(GISBASE)/etc/python (making it work on Windows isn't
straightforward, so I don't expect it to change in 6.x).
> Just one last question: How can I retrieve image projection, using a
> Python script, with tghe same information-structure I get when I use:
> grass.read_command('g.proj', flags = 'jf').strip()
grass.read_command('g.proj', flags = 'jf', georef = filename).strip()
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list