[GRASS-dev] Re: [GRASS GIS] #1447: wxGUI wingrass scripts need whitespace in path

GRASS GIS trac at osgeo.org
Fri Sep 23 10:23:28 EDT 2011


#1447: wxGUI wingrass scripts need whitespace in path
------------------------------+---------------------------------------------
 Reporter:  mmetz             |       Owner:  grass-dev@…              
     Type:  defect            |      Status:  new                      
 Priority:  major             |   Milestone:  6.4.2                    
Component:  wxGUI             |     Version:  svn-releasebranch64      
 Keywords:  wingrass, spaces  |    Platform:  MSWindows XP             
      Cpu:  All               |  
------------------------------+---------------------------------------------

Comment(by mmetz):

 Replying to [comment:7 mmetz]:
 >
 > Mysterious. Maybe someone can make some sense out of it.

 I found a workaround but I am not sure if this is correct:

 The *args argument to subprocess.Popen [0] is a list of arguments.
 subprocess.Popen converts the arguments differently, depending on whether
 there is whitespace in an argument or not. The result is meant as input
 for programs and apparently sometimes incompatible with "sh -c
 <grass.module> <arguments>". The problem for file input arguments arises
 if there is no whitespace in there because sh removes all backslashes left
 over by subprocess.Popen. The workaround is to convert the *args list into
 one long string with whitespaces, file paths quoted earlier when creating
 the command:
 {{{
 v.in.geonames input="D:\GRASS_test_data\IT\IT.txt" out=italy_geonames
 }}}
 and use that string instead of *args for
 {{{
 subprocess.Popen.__init__(self, *args, **kwargs)
 }}}

 This workaround is obviously only needed for wingrass. And looks like a
 terrible hack to me. Unfortunately this breaks C modules, so scripts and C
 modules would need to be treated differently...

 [0]
 https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gcmd.py#L124

 Out of ideas,

 Markus M

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1447#comment:8>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list