[GRASS-windows] Re: r.basin for windows [was Re: WinGrass6.5.svn-installer with selected addons]

Glynn Clements glynn at gclements.plus.com
Fri Oct 21 11:34:24 EDT 2011


Helmut Kudrnovsky wrote:

> >> there are following error messages:
> >
> >> File "C:\Program Files\GRASS6.5.SVN\Python25\lib\threading.py", line 13,
> >> in <module>
> >> from collections import deque
> >> ImportError: No module named collections
> >
> >This is a common error caused by a broken Python installation or
> >attempting to mix Python versions (e.g. setting PYTHONPATH or
> >PYTHONHOME to point to one version but using the Python interpreter
> >from a different version). 
> 
> ok. 
> 
> there is the python bundled with wingrass65 and a few other ones i.e.
> installed by arcgis
> (in C:\Python26\ArcGIS10.0\) or by openoffice (in C:\Program
> Files\OpenOffice.org 3\program) 
> or inkscape (C:\Program Files\Inkscape\python) etc. here on my box.
> 
> so some source of messing up?
> 
> why is then the wxgui working normally?

The wx GUI is invoked via $GRASS_PYTHON.

This was originally done because the wx GUI contained binary modules
(vdigit and nviz) which would only work with the specific version of
the Python interpreter for which they were compiled.

> >With respect to GRASS, the usual reason for this error is the attempt
> >to "bundle" a copy of Python in the GRASS installer. 
> >
> >Bear in mind that, on Windows, "executing" a Python script (whether
> >from cmd.exe, the GUI, or via subprocess.Popen() or os.system()) will
> >use the Python interpreter associated with the .py extension. If
> >PYTHONHOME and/or PYTHONPATH refer to a different version, it will
> >break. 
> 
> is it possible to test which python interpreter is associated with the
> .py-extension?

Create a Python script (with a .py extension) which prints useful
information (e.g. sys.prefix, sys.path, sys.version, etc), then
"execute" it via any native interface, e.g. system() in C, os.system()
or subprocess.Popen(..., shell=True) in Python, or "cmd /c ..." from a
shell script.

The "sys" module is part of the main Python DLL, so it isn't affected
by PYTHONHOME and PYTHONPATH.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-windows mailing list