[GRASS-dev] [GRASS GIS] #2708: Run GRASS with Python3

GRASS GIS trac at osgeo.org
Tue Jul 21 11:35:39 PDT 2015


#2708: Run GRASS with Python3
--------------------------+-------------------------
  Reporter:  zarch        |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.0.1
 Component:  Default      |    Version:  unspecified
Resolution:               |   Keywords:
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------

Comment (by glynn):

 Replying to [comment:2 zarch]:

 >
 {{{
 In [5]: "%s=%s" % (b'raster'.decode(), b'elevation'.decode())
 Out[5]: 'raster=elevation'
 }}}
 >
 > Do you have an idea on how we could/should fix this?

 Just avoid using string formatting for such trivial cases, e.g.:

 {{{
 args.append(opt.encode('ascii') + b'=' + _make_val(val)
 }}}

 To be honest, converting grass.script to Python 3 isn't going to be much
 fun, as a scripting library fundamentally revolves around dealing with
 byte strings (command-line arguments, environment variables,
 stdin/stdout), while Python 3 tries to pretend that byte strings are some
 kind of low-level implementation detail in a world where everything is
 Unicode.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2708#comment:3>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list