[GRASS-dev] [GRASS GIS] #2886: v.import/r.import: UnicodeEncodeError when path contains special characters

GRASS GIS trac at osgeo.org
Mon Feb 1 08:34:41 PST 2016


#2886: v.import/r.import: UnicodeEncodeError when path contains special characters
--------------------------+----------------------------------------
  Reporter:  mlennert     |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.0.4
 Component:  Default      |    Version:  svn-trunk
Resolution:               |   Keywords:  v.import r.import encoding
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+----------------------------------------

Comment (by mlennert):

 Replying to [ticket:2886 mlennert]:
 > Trying to importing a file that resides in a path with special
 characters (accent in this case), I get the following errors.
 >
 > In trunk:
 >
 >
 > {{{
 > > v.import
 input=/home/mlennert/Données/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp
 output=countries
 > Traceback (most recent call last):
 >   File "/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/scripts/v.import", line 284, in <module>
 >     options, flags = grass.parser()
 >   File "/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/script/core.py", line 719, in parser
 >     cmdline += [b'"' + encode(arg) + b'"' for arg in sys.argv[1:]]
 >   File "/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/script/utils.py", line 174, in encode
 >     return string.encode(enc)
 > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 25:
 ordinal not in range(128)
 > }}}
 >
 > In release70:

 Correction: in release70 the below error is due to GISDBASE containing an
 accent, not because of the file path. When GISDBASE does not contain an
 accent, below import works, even if the path to the imported file contains
 an accent.

 >
 >
 > {{{
 > > v.import
 input=/home/mlennert/Données/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp
 output=countries
 > Traceback (most recent call last):
 >   File "/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-pc-linux-
 gnu/scripts/v.import", line 273, in <module>
 >     sys.exit(main())
 >   File "/home/mlennert/SRC/GRASS/grass70_release/dist.x86_64-pc-linux-
 gnu/scripts/v.import", line 158, in main
 >     f.write('GISDBASE: %s\n' % GISDBASE)
 > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
 position 29: ordinal not in range(128)
 > }}}
 >

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2886#comment:1>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list