[GRASS-SVN] r74010 - in grass/trunk: gui/wxpython/core lib/python/script
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 25 02:32:57 PST 2019
Author: martinl
Date: 2019-01-25 02:32:57 -0800 (Fri, 25 Jan 2019)
New Revision: 74010
Modified:
grass/trunk/gui/wxpython/core/gcmd.py
grass/trunk/lib/python/script/core.py
Log:
winGRASS 7.7svn execute command fails, see #3733
Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py 2019-01-23 14:52:21 UTC (rev 74009)
+++ grass/trunk/gui/wxpython/core/gcmd.py 2019-01-25 10:32:57 UTC (rev 74010)
@@ -163,7 +163,8 @@
def __init__(self, args, **kwargs):
if is_mswindows:
- args = map(EncodeString, args)
+ # encoding not needed for Python3
+ # args = list(map(EncodeString, args))
# The Windows shell (cmd.exe) requires some special characters to
# be escaped by preceding them with 3 carets (^^^). cmd.exe /?
@@ -233,13 +234,14 @@
if not self.stdin:
return None
+ import pywintypes
try:
x = msvcrt.get_osfhandle(self.stdin.fileno())
(errCode, written) = WriteFile(x, input)
except ValueError:
return self._close('stdin')
- except (subprocess.pywintypes.error, Exception) as why:
- if why[0] in (109, errno.ESHUTDOWN):
+ except (pywintypes.error, Exception) as why:
+ if why.winerror in (109, errno.ESHUTDOWN):
return self._close('stdin')
raise
@@ -250,6 +252,7 @@
if conn is None:
return None
+ import pywintypes
try:
x = msvcrt.get_osfhandle(conn.fileno())
(read, nAvail, nMessage) = PeekNamedPipe(x, 0)
@@ -259,8 +262,8 @@
(errCode, read) = ReadFile(x, nAvail, None)
except ValueError:
return self._close(which)
- except (subprocess.pywintypes.error, Exception) as why:
- if why[0] in (109, errno.ESHUTDOWN):
+ except (pywintypes.error, Exception) as why:
+ if why.winerror in (109, errno.ESHUTDOWN):
return self._close(which)
raise
Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py 2019-01-23 14:52:21 UTC (rev 74009)
+++ grass/trunk/lib/python/script/core.py 2019-01-25 10:32:57 UTC (rev 74010)
@@ -274,7 +274,7 @@
# so, lets remove extension
if os.path.splitext(cmd)[1] == '.py':
cmd = cmd[:-3]
- full_path = shutil_which(cmd + '.py')
+ full_path = shutil_which(encode(cmd) + b'.py')
if full_path:
return full_path
More information about the grass-commit
mailing list