Johannes Radinger | 30 Aug 16:32 2011
Picon
Picon

WinGRASS Python 2.7

Hello,

because I want to use some pythonscripts that only work (or can be installed) with Python 2.7, I'd like to
couple my WinGRASS 6.4.1 with my
Python2.7 installation instead of the GRASS-Python.

So my Setup:
* Windows 7
* WinGRASS 6.4.1 (most recent)
* Python 2.7

Following Environemtal Variables are set:
* PATH includes C:\Python27
* GRASS_PYTHON includes C:\Python27\python.exe
* PYTHONPATH includes %GISBASE%\etc\python

So my questions:
1) How can I check which Pyhton is in use by WinGrass?
2) Is there anything else I've to set?

Thank you very much!
best regards
Johannes
--

-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
grass-user mailing list
grass-user <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
(Continue reading)

Glynn Clements | 30 Aug 21:35 2011

Re: [GRASS-windows] WinGRASS Python 2.7


Johannes Radinger wrote:

> because I want to use some pythonscripts that only work (or can be
> installed) with Python 2.7, I'd like to couple my WinGRASS 6.4.1
> with my Python2.7 installation instead of the GRASS-Python.
> 
> So my Setup:
> * Windows 7
> * WinGRASS 6.4.1 (most recent)
> * Python 2.7
> 
> Following Environemtal Variables are set:
> * PATH includes C:\Python27
> * GRASS_PYTHON includes C:\Python27\python.exe
> * PYTHONPATH includes %GISBASE%\etc\python
> 
> 
> So my questions:
> 1) How can I check which Pyhton is in use by WinGrass?

The wx GUI uses GRASS_PYTHON. To check which version is being used:

1. Start the wx GUI
2. Bring up Windows' Task Manager
3. Switch to the Processes tab
4. Find the python.exe (or pythonw.exe) process in the list
5. Right click on the entry for the process
6. Choose "Open File Location" from the menu

(Continue reading)

Martin Landa | 30 Aug 22:41 2011
Picon

Re: Re: [GRASS-windows] WinGRASS Python 2.7

Hi,

2011/8/30 Glynn Clements <glynn <at> gclements.plus.com>:
>> So my questions:
>> 1) How can I check which Pyhton is in use by WinGrass?

starting with 6.4.2 wxGUI has also python shell ('Python shell' tab in
Layer Manager) [1]. Here you can also see which version of Python is
used.

Martin

[1] http://grass.osgeo.org/wiki/File:Wxgui-pyshell.png

--

-- 
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa
_______________________________________________
grass-user mailing list
grass-user <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Johannes Radinger | 31 Aug 11:07 2011
Picon
Picon

Re: [GRASS-windows] WinGRASS Python 2.7

Hi,

-------- Original-Nachricht --------
> Datum: Tue, 30 Aug 2011 20:35:30 +0100
> Von: Glynn Clements <glynn <at> gclements.plus.com>
> An: "Johannes Radinger" <JRadinger <at> gmx.at>
> CC: grass-windows <at> lists.osgeo.org, grass-user <at> lists.osgeo.org
> Betreff: Re: [GRASS-windows] WinGRASS Python 2.7

> 
> Johannes Radinger wrote:
> 
> > because I want to use some pythonscripts that only work (or can be
> > installed) with Python 2.7, I'd like to couple my WinGRASS 6.4.1
> > with my Python2.7 installation instead of the GRASS-Python.
> > 
> > So my Setup:
> > * Windows 7
> > * WinGRASS 6.4.1 (most recent)
> > * Python 2.7
> > 
> > Following Environemtal Variables are set:
> > * PATH includes C:\Python27
> > * GRASS_PYTHON includes C:\Python27\python.exe
> > * PYTHONPATH includes %GISBASE%\etc\python
> > 
> > 
> > So my questions:
> > 1) How can I check which Pyhton is in use by WinGrass?
> 
(Continue reading)

Glynn Clements | 31 Aug 21:49 2011

Re: [GRASS-windows] WinGRASS Python 2.7


Johannes Radinger wrote:

> So I checked the python.exe*32 (the only python that is running) in
> the taskmanager (after booting and starting the wxGUI). And although
> GRASS_PYTHON is set in the environmental variables to
> C:\Python27\python.exe, the python which is used is still the
> GRASS-Python in the path C:\Programm Files(x64)\GRASS
> 6.4.1\extrabin\python.exe
> 
> So what causes this? How can I proceed? What should I check?

How did you set GRASS_PYTHON?

AFAIK, it's set in %GISBASE%\etc\env.bat; this will override any
global setting.

--

-- 
Glynn Clements <glynn <at> gclements.plus.com>
_______________________________________________
grass-user mailing list
grass-user <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Johannes Radinger | 1 Sep 09:43 2011
Picon
Picon

Re: [GRASS-windows] WinGRASS Python 2.7

Hi,

-------- Original-Nachricht --------
> Datum: Wed, 31 Aug 2011 20:49:30 +0100
> Von: Glynn Clements <glynn <at> gclements.plus.com>
> An: "Johannes Radinger" <JRadinger <at> gmx.at>
> CC: grass-user <at> lists.osgeo.org, grass-windows <at> lists.osgeo.org
> Betreff: Re: [GRASS-windows] WinGRASS Python 2.7

> 
> Johannes Radinger wrote:
> 
> > So I checked the python.exe*32 (the only python that is running) in
> > the taskmanager (after booting and starting the wxGUI). And although
> > GRASS_PYTHON is set in the environmental variables to
> > C:\Python27\python.exe, the python which is used is still the
> > GRASS-Python in the path C:\Programm Files(x64)\GRASS
> > 6.4.1\extrabin\python.exe
> > 
> > So what causes this? How can I proceed? What should I check?
> 
> How did you set GRASS_PYTHON?
> 
> AFAIK, it's set in %GISBASE%\etc\env.bat; this will override any
> global setting.

I set the environmental variables in the environment settings in the system properties as I was told some
months ago here in the mailing list.
Anyway I found the env.bat file. It contains besides others following lines:

(Continue reading)

Glynn Clements | 1 Sep 21:49 2011

Re: Re: [GRASS-windows] WinGRASS Python 2.7


Johannes Radinger wrote:

> > How did you set GRASS_PYTHON?
> > 
> > AFAIK, it's set in %GISBASE%\etc\env.bat; this will override any
> > global setting.
> 
> 
> I set the environmental variables in the environment settings in the
> system properties as I was told some months ago here in the mailing
> list.

Ah; GRASS_PYTHON is only set in env.bat if it isn't already set. 
PYTHONHOME and PATH are set unconditionally.

> Anyway I found the env.bat file. It contains besides others following
> lines:
> 
> rem Path to the python directory
> set PYTHONHOME=%GISBASE%\Python25
> if "x%GRASS_PYTHON%" == "x" set GRASS_PYTHON=python
> 
> 
> What exactly should be changed there and how should i look like? As I
> said before, the Python I want to be used is C:\Python27\python.exe. 
> As it is set in the environemntal variables do I just need to delete
> it from the env.bat or what shoul I do exactly?

The above should only set GRASS_PYTHON if it isn't already set. 
(Continue reading)

Helmut Kudrnovsky | 1 Sep 23:37 2011
Picon

Re: [GRASS-windows] WinGRASS Python 2.7

>The original reason for bundling Python was that the GUI included a
>couple of binary components (vdigit and nviz), which would only work
>with the specific version of Python against which they were built. 
>Those components have since been removed, but currently we don't have
>anyone who is able and willing to fix the Window installer.

for a starting point see "WinGrass using www.python.org-installation":
http://trac.osgeo.org/grass/ticket/1282

best regards
Helmut

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WinGRASS-Python-2-7-tp6742359p6751818.html
Sent from the Grass - Users mailing list archive at Nabble.com.
_______________________________________________
grass-user mailing list
grass-user <at> lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Johannes Radinger | 2 Sep 09:47 2011
Picon
Picon

Re: Re: [GRASS-windows] WinGRASS Python 2.7

Hello again!

As recommended I did the changes.
I just tried to first disable the PYTHONHOME and
GRASS_PYTHON. The lines in the env.bat file are now:

rem Path to the python directory
rem set PYTHONHOME=%GISBASE%\Python25
rem if "x%GRASS_PYTHON%" == "x" set GRASS_PYTHON=python

is that correct?

I tried at this step to start GRASS but it doesn't work
anymore. Nothing is started!! So it seems that this isn't
working! Maybe I have to set the path to python.org in the
env.bat, but I don't know how the lines should look like.

What to do next? Is that a kind of bug in the WinGRASS version?

/johannes

-------- Original-Nachricht --------
> Datum: Thu, 1 Sep 2011 20:49:21 +0100
> Von: Glynn Clements <glynn <at> gclements.plus.com>
> An: "Johannes Radinger" <JRadinger <at> gmx.at>
> CC: grass-user <at> lists.osgeo.org, grass-windows <at> lists.osgeo.org
> Betreff: Re: [GRASS-user] Re: [GRASS-windows] WinGRASS Python 2.7

> 
> Johannes Radinger wrote:
(Continue reading)

Glynn Clements | 5 Sep 02:57 2011

Re: Re: [GRASS-windows] WinGRASS Python 2.7


Johannes Radinger wrote:

> As recommended I did the changes.
> I just tried to first disable the PYTHONHOME and
> GRASS_PYTHON. The lines in the env.bat file are now:
> 
> rem Path to the python directory
> rem set PYTHONHOME=%GISBASE%\Python25
> rem if "x%GRASS_PYTHON%" == "x" set GRASS_PYTHON=python
> 
> is that correct?
> 
> 
> I tried at this step to start GRASS but it doesn't work
> anymore. Nothing is started!! So it seems that this isn't
> working! Maybe I have to set the path to python.org in the
> env.bat, but I don't know how the lines should look like.

For the GUI, setting e.g.:

	set GRASS_PYTHON=c:\Program Files (x86)\Python27\pythonw.exe

should suffice.

If you want to run Python scripts from bash, you may run into problems
if there are any spaces in any of the directories. Using an 8.3
filename may work, e.g.:

	export PATH=$PATH:/c/PROGRA~2/Python27/pythonw.exe
(Continue reading)

Johannes Radinger | 6 Sep 13:44 2011
Picon
Picon

Re: Re: [GRASS-windows] WinGRASS Python 2.7

Hi again,

sorry for posting again, but somehow I can't get it work to
run GRASS GIS using my local Python 2.7 installation.
See comments below:

-------- Original-Nachricht --------
> Datum: Mon, 5 Sep 2011 01:57:38 +0100
> Von: Glynn Clements <glynn <at> gclements.plus.com>
> An: "Johannes Radinger" <JRadinger <at> gmx.at>
> CC: grass-user <at> lists.osgeo.org, grass-windows <at> lists.osgeo.org
> Betreff: Re: [GRASS-user] Re: [GRASS-windows] WinGRASS Python 2.7

> 
> Johannes Radinger wrote:
> 
> > As recommended I did the changes.
> > I just tried to first disable the PYTHONHOME and
> > GRASS_PYTHON. The lines in the env.bat file are now:
> > 
> > rem Path to the python directory
> > rem set PYTHONHOME=%GISBASE%\Python25
> > rem if "x%GRASS_PYTHON%" == "x" set GRASS_PYTHON=python
> > 
> > is that correct?
> > 
> > 
> > I tried at this step to start GRASS but it doesn't work
> > anymore. Nothing is started!! So it seems that this isn't
> > working! Maybe I have to set the path to python.org in the
(Continue reading)

Glynn Clements | 8 Sep 09:43 2011

Re: Re: [GRASS-windows] WinGRASS Python 2.7


Johannes Radinger wrote:

> So what I tried now were three different settings in the env.bat

Ugh. Init.bat ignores GRASS_PYTHON and just uses "python":

	python "%GISBASE%/etc/wxpython/gis_set.py"
	if %errorlevel% == 2 goto exitinit
	python "%GISBASE%/etc/wxpython/wxgui.py"

That should probably be:

	"%GRASS_PYTHON%" "%GISBASE%/etc/wxpython/gis_set.py"
	if %errorlevel% == 2 goto exitinit
	"%GRASS_PYTHON%" "%GISBASE%/etc/wxpython/wxgui.py"

GRASS_PYTHON is honoured by g.gui, the dialogs generated by the
parser, and the Unix start-up script, but not by Init.bat.

> Just to inform you why I need that: I wrote a .py script (including
> g.parser elements) which I want to call inside GRASS with "file.py"

Note that if you add .PY to PATHEXT, e.g.:

	set PATHEXT=%PATHEXT%;.PY

you can omit the ".py" suffix when running the script. This is the
preferred approach, for portability reasons. In 7.0 (where the shell
scripts have been replaced with Python scripts), the scripts are
(Continue reading)


Gmane