[GRASS-user] with AND python

Milton Cezar Ribeiro miltinho.astronauta at gmail.com
Mon May 4 20:38:55 EDT 2009


Hi Rgurus,

I am trying to play with grass and python under Msys (windows).
I wrote a silly code, only to test if python can be run fom grass.

GRASS 6.4.0RC4 (newLocation):~ > cat aaa.py
a =1
b = "The world is real"
print a,b

GRASS 6.4.0RC4 (newLocation):~ > python aaa.py
1 The world is real
c:\Python26\lib\site.py:150: Warning: 'with' will become a reserved keyword
in Python 2.6
'import site' failed; use -v for traceback
#----
As you can see, I can run the python code from grass, but I receive a
warning message.
But when I try to import grass, I get an error message:

GRASS 6.4.0RC4 (newLocation):~ > cat grass_python_test.py
import sys
import grass

GRASS 6.4.0RC4 (newLocation):~ > python grass_python_test.py
c:\Python26\lib\site.py:150: Warning: 'with' will become a reserved keyword
in Python 2.6
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "grass_python_test.py", line 2, in <module>
    import grass
  File "C:\OSGeo4W\apps\grass\grass-6.4.0RC4\etc\python\grass.py", line 1,
in <module>
    import os
  File "c:\Python26\lib\os.py", line 757
    bs = b""
           ^
SyntaxError: invalid syntax

Any help are welcome.

milton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20090504/c0378803/attachment.html


More information about the grass-user mailing list