#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
}}}
#3773: shutil_which() throws an exception on Linux + Python 3
--------------------------+-------------------------
Reporter: pmav99 | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.8.0
Component: Python | Version: svn-trunk
Resolution: | Keywords: python3
CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Comment (by pmav99):
{{{shutil_which}}} is being used by {{{assertModule}}} which practically
means that it is not currently possible to run {{{gunnitest}}} based tests
on Python 3.
-
+# TODO: Please replace this function with shutil.which() before 8.0 comes
out
# replacement for which function from shutil (not available in all
versions)
# from http://hg.python.org/cpython/file/6860263c05b3/Lib/shutil.py#l1068
# added because of Python scripts running Python scripts on MS Windows
@@ -239,6 +239,8 @@
return name
return None