[GRASS-dev] [GRASS GIS] #3773: shutil_which() throws an exception on Linux + Python 3
GRASS GIS
trac at osgeo.org
Tue Mar 5 11:10:20 PST 2019
#3773: shutil_which() throws an exception on Linux + Python 3
-------------------------+-------------------------
Reporter: pmav99 | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone:
Component: Python | Version: svn-trunk
Keywords: | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
{{{
Traceback (most recent call last):
File "raster/r.report/testsuite/test_r_report.py", line 68, in
test_output
self.assertModule('r.report', map='lakes', output=self.outfile)
File "/home/feanor/Prog/git/grass-p3/repo/dist.x86_64-pc-linux-
gnu/etc/python/grass/gunittest/case.py", line 1145, in assertModule
if not shutil_which(module.name):
File "/home/feanor/Prog/git/grass-p3/repo/dist.x86_64-pc-linux-
gnu/etc/python/grass/script/core.py", line 225, in shutil_which
name = os.path.join(encode(dir), thefile)
File "/usr/lib/python3.7/posixpath.py", line 94, in join
genericpath._check_arg_types('join', a, *p)
File "/usr/lib/python3.7/genericpath.py", line 151, in _check_arg_types
raise TypeError("Can't mix strings and bytes in path components") from
None
TypeError: Can't mix strings and bytes in path components
}}}
This was introduced at https://trac.osgeo.org/grass/changeset/73930
A possible resolution could be:
{{{
import six
if six.PY3:
shutil_which = shutil.which
else:
def shutil_which(...):
# ...
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3773>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list