Skip to content

Commit

Permalink
extend special handling of sys.executable to pythonX[.Y]
Browse files Browse the repository at this point in the history
this should allow ipykernel's wheel-installed specs to specify `python3` or `python2` and prevent
python2 kernels from launching with sys.executable if the Python version is 3.
  • Loading branch information
minrk committed Nov 22, 2017
1 parent 0d7d00f commit 948d653
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions jupyter_client/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
import signal
import sys
import time
import warnings
try:
from queue import Empty # Py 3
except ImportError:
from Queue import Empty # Py 2

import zmq

Expand All @@ -29,7 +24,6 @@
kernelspec,
)
from .connect import ConnectionFileMixin
from .session import Session
from .managerabc import (
KernelManagerABC
)
Expand Down Expand Up @@ -164,8 +158,10 @@ def format_kernel_cmd(self, extra_arguments=None):
else:
cmd = self.kernel_spec.argv + extra_arguments

if cmd and cmd[0] == 'python':
# executable is 'python', use sys.executable.
if cmd and cmd[0] in {'python',
'python%i' % sys.version_info[0],
'python%i.%i' % sys.version_info[:2]}:
# executable is 'python' or 'python3', use sys.executable.
# These will typically be the same,
# but if the current process is in an env
# and has been launched by abspath without
Expand Down

0 comments on commit 948d653

Please sign in to comment.