[GRASS-dev] [GRASS GIS] #3773: shutil_which() throws an exception on Linux + Python 3
GRASS GIS
trac at osgeo.org
Wed Mar 6 23:03:46 PST 2019
#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):
That's the least invasive patch I can think off:
{{{
Index: lib/python/script/core.py
===================================================================
--- lib/python/script/core.py (revision 74173)
+++ lib/python/script/core.py (working copy)
@@ -164,7 +164,7 @@
return set(cmd), scripts
-
+# 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
+if sys.version_info.major > 2:
+ shutil_which = shutil.which
# Added because of scripts calling scripts on MS Windows.
# Module name (here cmd) differs from the file name (does not have
extension).
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3773#comment:4>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list