[GRASS-dev] Handling of Python scripts on MS Windows

Vaclav Petras wenzeslaus at gmail.com
Mon Feb 10 11:29:02 PST 2014


On Mon, Feb 10, 2014 at 2:17 PM, Markus Metz
<markus.metz.giswork at gmail.com>wrote:

> On Mon, Feb 10, 2014 at 6:44 PM, Vaclav Petras <wenzeslaus at gmail.com>
> wrote:
> >
> >
> >
> > On Mon, Feb 10, 2014 at 8:41 AM, Markus Metz <
> markus.metz.giswork at gmail.com>
> > wrote:
> >>
> >> On Mon, Feb 10, 2014 at 12:04 PM, Moritz Lennert
> >> <mlennert at club.worldonline.be> wrote:
> >> > On 10/02/14 11:46, Markus Metz wrote:
> >> >>
> >> >> On Mon, Feb 10, 2014 at 11:26 AM, Helmut Kudrnovsky <hellik at web.de>
> >> >> wrote:
> >> >>>>>
> >> >>>>> Therefore we need
> >> >>>>> hard-coded special treatment for shell and Python scripts in order
> >> >>>>> to
> >> >>>>> make sure that the correct interpreter is used.
> >> >>>
> >> >>>
> >> >>>> Just for my understanding: When you say hard-coded special
> treatment
> >> >>>> for
> >> >>>> shell scripts, are you speaking about the .bat files ?
> >> >>>
> >> >>>
> >> >>> I think yes.
> >> >>
> >> >>
> >> >> Or more generally, any mechanism explicitly using %GRASS_PYTHON%
> >> >> script.py.
> >> >
> >> >
> >> > But as far as I've seen, this might not be sufficient since this only
> >> > indicates which Python executable to use for launching the Python
> >> > script,
> >> > but any library calls linked to that execution will involve the
> >> > system-wide
> >> > installed Python. Which is different from bash scripts, where this is
> >> > not an
> >> > issue.
> >>
> >> GRASS Python scripts are currently executed using the system-wide
> >> installed Python if it exists. No attempt has been made to explicitly
> >> use GRASS_PYTHON, therefore it is not possible to say if the system's
> >> Python would really be completely ignored.
> >
> >
> > If I remember correctly, Python scripts were not working from Python
> > scripts, they were working from command line.
>
> Which command line? If you used the msys command line, it should work
> because within msys, the embedded GRASS_PYTHON version is readily
> available:
>
> GRASS 7.0.svn> which python
> /c/Programme/GRASS GIS 7.0.svn/extrabin/python.exe
>
> > And we were not able to
> > explain why the right Python (or Python DLL) is used at one point but not
> > the other.
>
> If you used the GUI, you are outside the msys shell and the system's
> Python is used. Scripts invoke other GRASS modules with
> grass.run_command() which uses the system's script interpreter if the
> module is a script.
>
> So, msys is able to configure our Python in the way that it is usable
without interference with the system Python.

Markus M
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140210/a5feeb4b/attachment-0001.html>


More information about the grass-dev mailing list