[GRASS-dev] [GRASS GIS] #2150: Cannot call Python scripts from Python on MS Windows

GRASS GIS trac at osgeo.org
Wed Jan 1 09:26:41 PST 2014


#2150: Cannot call Python scripts from Python on MS Windows
-------------------------------------------+--------------------------------
 Reporter:  wenzeslaus                     |       Owner:  grass-dev@…              
     Type:  defect                         |      Status:  new                      
 Priority:  blocker                        |   Milestone:  7.0.0                    
Component:  Python                         |     Version:  svn-releasebranch64      
 Keywords:  packaging, MAXREPEAT, scripts  |    Platform:  MSWindows 7              
      Cpu:  Unspecified                    |  
-------------------------------------------+--------------------------------
 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 `MAXREPEAT` error.

 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:
  * [http://lists.osgeo.org/pipermail/grass-dev/2013-April/063285.html new
 osgeo4w-python and winGrass643RC3-standalone: error in GUI startup] ([http
 ://osgeo-org.1560.x6.nabble.com/new-osgeo4w-python-and-winGrass643RC3
 -standalone-error-in-GUI-startup-td5048496.html nabble])
  * [http://lists.osgeo.org/pipermail/grass-dev/2013-July/065197.html
 Python handling in winGRASS7] ([http://osgeo-org.1560.x6.nabble.com/Re-
 GRASS-GIS-7-tech-preview-release-preparations-tp5066002p5069419.html
 nabble])
  * [http://lists.osgeo.org/pipermail/grass-dev/2013-October/065896.html
 Handling of Python scripts on MS Windows] ([http://osgeo-
 org.1560.x6.nabble.com/Handling-of-Python-scripts-on-MS-Windows-
 td5081335.html 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

 Provided patches:
  * putting DLLs to `bin` not `lib` in 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.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2150>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list