I want to write some a GRASS geoprocessing script in Python. However Python crashes at the first line when importing the grass scripting module:
from grass.script import *
Unhandled exception while debugging...
Traceback (most recent call last):
File "D:\clients\AlainPaquette\AnalyseDeCimeGRASS\CrownDelineator01.py", line 1, in <module>
from grass.script import *
File "C:\Program Files\GRASS-64\etc\python\grass\script\__init__.py", line 1, in <module>
from core import *
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 867, in <module>
debug_level = int(gisenv().get('DEBUG', 0))
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 505, in gisenv
s = read_command("g.gisenv", flags='n')
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 216, in read_command
ps = pipe_command(*args, **kwargs)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 193, in pipe_command
return start_command(*args, **kwargs)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 155, in start_command
return Popen(args, **popts)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 53, in __init__
startupinfo, creationflags)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 587, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 700, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 745, in _make_inheritable
DUPLICATE_SAME_ACCESS)
WindowsError: (6, 'Descripteur non valide')
[Dbg]>>>
2011/1/27 Pierre Racine <Pierre.Racine@sbf.ulaval.ca>:
I want to write some a GRASS geoprocessing script in Python. However Python crashes at the first line when importing the grass scripting module:
from grass.script import *
Unhandled exception while debugging...
Traceback (most recent call last):
File "D:\clients\AlainPaquette\AnalyseDeCimeGRASS\CrownDelineator01.py", line 1, in <module>
from grass.script import *
File "C:\Program Files\GRASS-64\etc\python\grass\script\__init__.py", line 1, in <module>
from core import *
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 867, in <module>
debug_level = int(gisenv().get('DEBUG', 0))
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 505, in gisenv
s = read_command("g.gisenv", flags='n')
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 216, in read_command
ps = pipe_command(*args, **kwargs)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 193, in pipe_command
return start_command(*args, **kwargs)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 155, in start_command
return Popen(args, **popts)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 53, in __init__
startupinfo, creationflags)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 587, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 700, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 745, in _make_inheritable
DUPLICATE_SAME_ACCESS)
WindowsError: (6, 'Descripteur non valide')
[Dbg]>>>
I used GRASS 6.4, Windows XP, PythonWin
testing GRASS 7.0 and 6.4 from [1] seems to work. Using python
distributed with standalone installer, not PythonWin.
How can I identify the exact version of GRASS I have already installed? It says only 6.4 and the version in the site is WinGRASS-6.4.SVN-r45209-1
-----Original Message-----
From: Martin Landa [mailto:landa.martin@gmail.com]
Sent: 27 janvier 2011 10:22
To: Pierre Racine
Cc: grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Problem importing grass.script python module on Windows
Hi,
2011/1/27 Pierre Racine <Pierre.Racine@sbf.ulaval.ca>:
I want to write some a GRASS geoprocessing script in Python. However Python crashes at the first
line when importing the grass scripting module:
from grass.script import *
Unhandled exception while debugging...
Traceback (most recent call last):
File "D:\clients\AlainPaquette\AnalyseDeCimeGRASS\CrownDelineator01.py", line 1, in <module>
from grass.script import *
File "C:\Program Files\GRASS-64\etc\python\grass\script\__init__.py", line 1, in <module>
from core import *
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 867, in <module>
debug_level = int(gisenv().get('DEBUG', 0))
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 505, in gisenv
s = read_command("g.gisenv", flags='n')
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 216, in read_command
ps = pipe_command(*args, **kwargs)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 193, in pipe_command
return start_command(*args, **kwargs)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 155, in start_command
return Popen(args, **popts)
File "C:\Program Files\GRASS-64\etc\python\grass\script\core.py", line 53, in __init__
startupinfo, creationflags)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 587, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 700, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "C:\Program Files\GRASS-64\Python25\lib\subprocess.py", line 745, in _make_inheritable
DUPLICATE_SAME_ACCESS)
WindowsError: (6, 'Descripteur non valide')
[Dbg]>>>
I used GRASS 6.4, Windows XP, PythonWin
testing GRASS 7.0 and 6.4 from [1] seems to work. Using python
distributed with standalone installer, not PythonWin.