Opened 8 years ago

Closed 6 years ago

#3171 closed defect (fixed)

Python script fails on windows if parameter contains non-latin letters

Reported by: marisn Owned by: grass-dev@…
Priority: normal Milestone: 7.4.3
Component: Python Version: svn-releasebranch72
Keywords: Cc:
CPU: Unspecified Platform: MSWindows 8

Description

I have written a python GRASS module that accepts string as an option (passed via parser). It runs just fine on Linux, but on Windows 10 it is causing failure:

gol name=ģļāžšķūņā ŗūķeļi steps=1000 density=0.25                               
Traceback (most recent call last):
  File ".\gol.py", line 233, in <module>
    options, flags = grass.parser()
  File "C:\OSGeo4W\apps\grass\grass-7.1.svn\etc\python\grass
\script\core.py", line 719, in parser
    cmdline += [b'"' + encode(arg) + b'"' for arg in
sys.argv[1:]]
  File "C:\OSGeo4W\apps\grass\grass-7.1.svn\etc\python\grass
\script\utils.py", line 174, in encode
    return string.encode(enc)
  File "C:\OSGeo4W\apps\Python27\lib\encodings\cp1257.py",
line 12, in encode
    return
codecs.charmap_encode(input,errors,encoding_table)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xec in
position 5: ordinal not in range(128)

The error seems to originate from the same place as for #2886

Change History (10)

comment:1 by marisn, 8 years ago

Info on version although the code seems to be the same also in trunk.

GRASS versija: 7.1.svn                                                          
GRASS SVN revision: 67699                                                       
Build date: 2016-01-29                                                          
Build platform: x86_64-w64-mingw32                                              
GDAL: 1.11.3                                                                    
PROJ.4: 4.9.2                                                                   
GEOS: 3.5.0                                                                     
SQLite: 3.7.17                                                                  
Python: 2.7.5                                                                   
wxPython: 2.8.12.1                                                              
Platform: Windows-8-6.2.9200 (OSGeo4W)

in reply to:  description comment:2 by glynn, 8 years ago

Replying to marisn:

I have written a python GRASS module that accepts string as an option (passed via parser). It runs just fine on Linux, but on Windows 10 it is causing failure:

I believe that this a consequence of releasebranch_7_2 incorporating r65804 but not r68927. I suggest backporting the latter.

comment:3 by wenzeslaus, 8 years ago

r68927 backported in r69617.

comment:4 by mlennert, 8 years ago

Has r69617 solved this issue ?

comment:5 by martinl, 8 years ago

Milestone: 7.2.17.2.2

comment:6 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:7 by lucadelu, 7 years ago

Could this ticket be closed?

comment:8 by martinl, 7 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:9 by martinl, 7 years ago

Milestone: 7.2.4

comment:10 by neteler, 6 years ago

Milestone: 7.2.47.4.3
Resolution: fixed
Status: newclosed

No answer, assuming that the issue was solved with the changes done.

Note: See TracTickets for help on using tickets.