[GRASS-dev] [GRASS GIS] #2532: TypeError: environment can only contain string when launching script on Windows
GRASS GIS
trac at osgeo.org
Mon Jan 5 11:58:53 PST 2015
#2532: TypeError: environment can only contain string when launching script on
Windows
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: encoding | Platform: MSWindows 8
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by glynn):
Replying to [ticket:2532 annakrat]:
> The problem is the script path is unicode type (although I am using only
ascii letters).
wxPython uses Unicode for almost everything. So retrieving the contents of
a text field will return a Python unicode value.
> The solution is to encode the script path, but with which encoding? And
how it is going to be decoded?
It won't be decoded. The byte string will be available to the called
program as a char* via getenv() (for C) or os.environ (Python).
> A temporary solution is to reject any scripts with path with non-ascii
letters and just use `str()`.
wxGUI's core.gcmd module has EncodeString() and DecodeString() methods
which use whatever wxGUI considers to be the "system" encoding. Those are
used by gcmd.Popen for converting the arguments to strings and by
gcmd.RunCommand() for converting the process' output to unicode.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2532#comment:1>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list