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
import grass
File “C:\OSGeo4W\apps\grass\grass-6.4.0RC4\etc\python\grass.py”, line 1, in
import os
File “c:\Python26\lib\os.py”, line 757
bs = b""
^
SyntaxError: invalid syntax
Any help are welcome.
milton
Dear all,
Almost on my system, running (windows, sorry), I can run only version 2.5 of python with grass.
Version 2.6 give a conflit because “wish” is a reserved word on 2.6 versioni.
How we can deal with it?
Cheers
milton
2009/5/4 Milton Cezar Ribeiro <miltinho.astronauta@gmail.com>
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
import grass
File “C:\OSGeo4W\apps\grass\grass-6.4.0RC4\etc\python\grass.py”, line 1, in
import os
File “c:\Python26\lib\os.py”, line 757
bs = b""
^
SyntaxError: invalid syntax
Any help are welcome.
milton