##// END OF EJS Templates
Popen doesn't support unicode args on Windows Python 2
MinRK -
Show More
@@ -21,6 +21,7 b' import os'
21 import sys
21 import sys
22 from subprocess import Popen, PIPE
22 from subprocess import Popen, PIPE
23
23
24 from IPython.utils.encoding import getdefaultencoding
24 from IPython.utils.py3compat import cast_bytes_py2
25 from IPython.utils.py3compat import cast_bytes_py2
25
26
26 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
@@ -188,12 +189,14 b' def launch_kernel(cmd, stdin=None, stdout=None, stderr=None,'
188 _stderr = PIPE if stderr is None else stderr
189 _stderr = PIPE if stderr is None else stderr
189 else:
190 else:
190 _stdout, _stderr = stdout, stderr
191 _stdout, _stderr = stdout, stderr
191
192
193 encoding = getdefaultencoding(prefer_stream=False)
194
192 # Spawn a kernel.
195 # Spawn a kernel.
193 if sys.platform == 'win32':
196 if sys.platform == 'win32':
194
197 # Popen on Python 2 on Windows cannot handle unicode args or cwd
198 cmd = [ cast_bytes_py2(c, encoding) for c in cmd ]
195 if cwd:
199 if cwd:
196 # Popen on Python 2 on Windows cannot handle unicode cwd.
197 cwd = cast_bytes_py2(cwd, sys.getfilesystemencoding() or 'ascii')
200 cwd = cast_bytes_py2(cwd, sys.getfilesystemencoding() or 'ascii')
198
201
199 from IPython.kernel.zmq.parentpoller import ParentPollerWindows
202 from IPython.kernel.zmq.parentpoller import ParentPollerWindows
General Comments 0
You need to be logged in to leave comments. Login now