[GRASS-user] Problem importing grass.script python module on Windows

Martin Landa landa.martin at gmail.com
Thu Jan 27 10:22:06 EST 2011


Hi,

2011/1/27 Pierre Racine <Pierre.Racine at 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.

Martin

[1] http://josef.fsv.cvut.cz/wingrass/

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


More information about the grass-user mailing list