Skip to content

Commit 16d8122

Browse files
authored
Merge pull request #306 from minrk/pythonX
extend special handling of sys.executable to pythonX[.Y]
2 parents 7bbb56d + 948d653 commit 16d8122

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

jupyter_client/manager.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
import signal
1212
import sys
1313
import time
14-
import warnings
15-
try:
16-
from queue import Empty # Py 3
17-
except ImportError:
18-
from Queue import Empty # Py 2
1914

2015
import zmq
2116

@@ -29,7 +24,6 @@
2924
kernelspec,
3025
)
3126
from .connect import ConnectionFileMixin
32-
from .session import Session
3327
from .managerabc import (
3428
KernelManagerABC
3529
)
@@ -164,8 +158,10 @@ def format_kernel_cmd(self, extra_arguments=None):
164158
else:
165159
cmd = self.kernel_spec.argv + extra_arguments
166160

167-
if cmd and cmd[0] == 'python':
168-
# executable is 'python', use sys.executable.
161+
if cmd and cmd[0] in {'python',
162+
'python%i' % sys.version_info[0],
163+
'python%i.%i' % sys.version_info[:2]}:
164+
# executable is 'python' or 'python3', use sys.executable.
169165
# These will typically be the same,
170166
# but if the current process is in an env
171167
# and has been launched by abspath without

0 commit comments

Comments
 (0)