[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 11 07:44:14 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 pmav99):
Now to the problem at hand.
{{{
if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
}}}
Pathext is an iterable (in this case a list) and the problem seems to be
that at least one of the pathext elements is a string instead of a bytes
object. Now, I don't understand why this happens, since lines 200-201
should handle the conversion to bytes. Anyway, to debug this try to add
the following line just before the problematic one:
{{{
import pprint
pprint.pprint([ext, type(ext) for ext in pathext])
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3837#comment:10>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list