Cannot call Python scripts from Python on MS Windows
|Reported by:||wenzeslaus||Owned by:|
|Keywords:||packaging, MAXREPEAT, scripts||Cc:|
On MS Windows, GRASS does not ensure that its Python executable is used when calling Python script from Python script. This is a problem when some other software installed some other version of Python system-wide.
Currently, GRASS is using Python 2.7.4 and when the 3rd party software installs Python 2.7.3 this one (EXE and DDL) is used but with 2.7.4 packages which causes the famous
It is not clear who to blame for the issue (GRASS, MS Windows way of calling programs or 3rd party software installing old Python) but it seems that it is GRASS who has to fix the problem.
The issue may appear when:
- Python script calls Python script
- wxGUI calls Python scripts (in its own way or using same mechanism as GRASS Python scripts; example is GUI command console)
- C module calling Python scripts (not included in the ticket title, no issue reported so far, probably not tested; case of g.gui and parser starting generated module forms/dialogs)
The issue was previously discussed in:
- new osgeo4w-python and winGrass643RC3-standalone: error in GUI startup (nabble)
- Python handling in winGRASS7 (nabble)
- Handling of Python scripts on MS Windows (nabble)
- #1941 wxGUI fails with Japanese locale --> mixed Python installs on Windows
- #2015 Missing file association dialog pops up all the time
- #2039 Startup Error
- putting DLLs to
libin r57639 + r57646 and for G6 r57694 (applied and works: GRASS GUI starts but calling Python scripts does not work)
- ensuring the right Python executable manually in r57910; the non-GUI part reverted in r57911 as a confusing workaround hiding the problem
It is possible to test using
v.db.univar module which calls
db.univar module (both are Python scripts).
The issue is not so big for G6 but it is very serious for G7 where a lot of modules are Python scripts. But it is even a bigger problem for addons and user scripts which are expected to be written mainly in Python using a lot of existing GRASS modules.
The issue is discussed at many places, let's continue the discussion here only.