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

GRASS GIS trac at osgeo.org
Sat Sep 10 12:15:18 EDT 2011


#1447: wxGUI wingrass scripts need whitespace in path
--------------------+-------------------------------------------------------
 Reporter:  mmetz   |       Owner:  grass-dev@…              
     Type:  defect  |      Status:  new                      
 Priority:  normal  |   Milestone:  6.4.2                    
Component:  wxGUI   |     Version:  svn-releasebranch64      
 Keywords:          |    Platform:  MSWindows XP             
      Cpu:  All     |  
--------------------+-------------------------------------------------------
 In wingrass wxGUI, whenever a file path is entered as input for a script,
 the script will fail if the path does '''not''' contain whitespace and
 succeeds only if the path does contain whitespace.

 Example:
 {{{
 # define options in wxGUI:
 v.in.geonames input=D:\GRASS_test_data\IT\IT.txt out=italy_geonames
 # output
 ERROR: File 'D:GRASS_test_dataITIT.txt' not found

 # that works in wxGUI:
 v.in.geonames input=D:\GRASS test data\IT\IT.txt out=italy_geonames
 }}}

 Interestingly, both commands
 {{{
 v.in.geonames input=D:\GRASS_test_data\IT\IT.txt out=italy_geonames

 v.in.geonames input="D:\GRASS test data\IT\IT.txt" out=italy_geonames
 }}}
 work from the command line.

 Also interestingly, this affects only scripts, not C modules, e.g.
 v.in.ogr always works whereas e.g. v.in.geonames fails from wxGUI if the
 command line does not contain at least one whitespace in the absolute
 path.

 g.parser receives from the wxGUI
 {{{
 D:GRASS_test_dataITIT.txt
 }}}
 and
 {{{
 D:\\GRASS test data\\IT\\IT.txt
 }}}

 Within the wxGUI, as far as I was able to trace the strings, they were
 {{{
 D:\\GRASS_test_data\\IT\\IT.txt
 }}}
 and
 {{{
 D:\\GRASS test data\\IT\\IT.txt
 }}}
 that is, ok.

 At some stage, the backslashes "\" are removed if no whitespace is in the
 string and correctly converted to "\\" if a whitespace is in the string. I
 was not able to find this stage in wxGUI and lib/python. I guess this is
 one tiny single line of python code messing up the string. Any
 suggestions?

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



More information about the grass-dev mailing list