Skip to content

Commit 3484780

Browse files
takluyverMeeseeksDev[bot]
authored andcommitted
Backport PR #306: extend special handling of sys.executable to pythonX[.Y]
1 parent f40dcd3 commit 3484780

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
)
@@ -174,8 +168,10 @@ def format_kernel_cmd(self, extra_arguments=None):
174168
else:
175169
cmd = self.kernel_spec.argv + extra_arguments
176170

177-
if cmd and cmd[0] == 'python':
178-
# executable is 'python', use sys.executable.
171+
if cmd and cmd[0] in {'python',
172+
'python%i' % sys.version_info[0],
173+
'python%i.%i' % sys.version_info[:2]}:
174+
# executable is 'python' or 'python3', use sys.executable.
179175
# These will typically be the same,
180176
# but if the current process is in an env
181177
# and has been launched by abspath without

0 commit comments

Comments
 (0)