[GRASS-user] Running Python scripts inside GRASS

Sonja Jankowfsky sonja.jankowfsky at cemagref.fr
Tue Mar 9 04:21:12 EST 2010

So, I deleted the C:\GRASS-4-SVN\Python25 directory and I checked that 
none of my system environment variables refers to this directory. 
Additionally I changed the PYTHONHOME to C:\Python26 in the 
grass64svn.bat file and in the C:\GRASS-4-SVN\etc\init.bat file and I 
added this variable to my system environment variables and in the 
C:\GRASS-4-SVN\msys\grass70.bat file.

However, I still get the following error, indicating that it doesn't 
find the os module.
Is there any other place where a wrong PYTHONPATH could be stored??? And 
is the wxpython GUI really compatible with Python26?

Cleaning up temporary files ...
Starting GRASS ...
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "c:/GRASS-4-SVN/etc/wxpython/gis_set.py", line 23, in <module>
    import os
ImportError: No module named os
Error in GUI startup. If necessary, please
report this error to the GRASS developers.
Switching to text mode now.
Hit RETURN to continue...

Glynn Clements a écrit :
> Sonja Jankowfsky wrote:
>> I uninstalled Python25 and 24 on my machine and reinstalled Python26 + 
>> the packages wxPython,
>> PyWin32, and NumPy. 
>> the ftype python.file in the command line changed to Python26 now. 
>> However, when I try to run the python script in GRASS I still get the following error:
>>  File "E:\pythoninput\test_simple.py", line 2, in <module>
>>      import grass.script as grass
>>    File "C:\GRASS-4-SVN\etc\python\grass\script\__init__.py", line 1, in 
>>  <module>
>>      from core   import *
>>   File "C:\GRASS-4-SVN\etc\python\grass\script\core.py", line 30, in 
>>  <module>
>>      import subprocess
>>    File "C:\GRASS-4-SVN\Python25\lib\subprocess.py", line 376, in <module>
> So you didn't remove the one version of Python which should have been
> removed, i.e. C:\GRASS-4-SVN\Python25.
> You should delete this directory, and change any environment variables
> which refer to it to refer to the system version of Python (e.g. 
> C:\Python26 or C:\Program Files\Python26) instead.

Sonja Jankowfsky
UR Hydrologie-Hydraulique
Cemagref de Lyon
3 bis quai Chauveau CP 220
69336 Lyon Cedex 09
Tel : (+33)4 72 20 86 11 	 
Fax : (+33)4 78 47 78 75 

More information about the grass-user mailing list