[GRASS-dev] [GRASS GIS] #3837: OSGeo4W winGRASS77svn - startup error: TypeError: endswith first arg must be bytes or a tuple of bytes, not str

GRASS GIS trac at osgeo.org
Sat May 4 11:45:02 PDT 2019


#3837: OSGeo4W winGRASS77svn - startup error: TypeError: endswith first arg must
be bytes or a tuple of bytes, not str
--------------------------+------------------------------------
  Reporter:  hellik       |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  blocker      |  Milestone:  7.8.0
 Component:  Python       |    Version:  svn-trunk
Resolution:               |   Keywords:  python3, py3, wingrass
       CPU:  Unspecified  |   Platform:  MSWindows
--------------------------+------------------------------------

Comment (by hellik):

 Replying to [comment:3 hellik]:
 > Replying to [comment:2 hellik]:
 > > Replying to [comment:1 hellik]:
 > > > see also
 > > >
 > > > https://trac.osgeo.org/grass/ticket/3733
 > >
 > > and also see
 > >
 > > https://trac.osgeo.org/grass/ticket/3723
 >
 > it seems there is still some encoding/decoding issue

 it's around

 {{{
 195         if sys.platform == "win32":
 196             # The current directory takes precedence on Windows.
 197             if not os.curdir in path:
 198                 path.insert(0, os.curdir)
 199
 200             # PATHEXT is necessary to check on Windows (force
 lowercase)
 201             pathext = list(map(lambda x: encode(x.lower()),
 202                                os.environ.get("PATHEXT",
 "").split(os.pathsep)))
 203             if b'.py' not in pathext:
 204                 # we assume that PATHEXT contains always '.py'
 205                 pathext.insert(0, b'.py')
 206             # See if the given file matches any of the expected path
 extensions.
 207             # This will allow us to short circuit when given
 "python.exe".
 208             # If it does match, only test that one, otherwise we have
 to try
 209             # others.
 210             if any(cmd.lower().endswith(ext) for ext in pathext):
 211                 files = [cmd]
 212             else:
 213                 files = [cmd + ext for ext in pathext]
 }}}

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



More information about the grass-dev mailing list