[GRASS-dev] [GRASS GIS] #2532: TypeError: environment can only contain string when launching script on Windows

GRASS GIS trac at osgeo.org
Wed Jan 21 20:16:05 PST 2015


#2532: TypeError: environment can only contain string when launching script on
Windows
-------------------------+--------------------------------------------------
 Reporter:  annakrat     |       Owner:  grass-dev@…              
     Type:  defect       |      Status:  new                      
 Priority:  normal       |   Milestone:  7.0.0                    
Component:  Default      |     Version:  svn-trunk                
 Keywords:  encoding     |    Platform:  MSWindows 8              
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------

Comment(by glynn):

 Replying to [comment:17 annakrat]:

 > > That makes sense. But the encoding should ideally be done at a higher
 level, at the point that wxGUI "knows" that it's dealing with a unicode
 value.
 >
 > I am not sure where the higher level is and why str and unicode are
 mixed in this case.

 Unicode values typically come from wxWidgets, e.g. any text retrieved from
 a text field will be a unicode object.

 > > I'm wondering if sys.setdefaultencoding("EBCDIC-CP-BE") would work ...
 >
 > Why would it? Is it easy to test?

 Sorry, that was really just thinking out loud. It wouldn't fix anything,
 it would just highlight any remaining implicit conversions.

 EBCDIC (used on IBM mainframes) is one of the few encodings which
 [b]isn't[/b] compatible (or even mostly-compatible) with ASCII. Setting
 the default encoding to EBCDIC would make it obvious when implicit
 str<->unicode conversions were being performed, because the results would
 be completely wrong (e.g. even A-Z/a-z don't have the same codepoints as
 ASCII).

 The default encoding can only be set in site.py; site.py deletes the
 setdefaultencoding() function from the sys module to prevent the default
 encoding from being changed after start-up.

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



More information about the grass-dev mailing list