From 0422a8c263ae52272e78eaaabee6bf8827a703d3 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 26 Jun 2018 07:01:10 +0100 Subject: [PATCH] parent: python_path setting depends on local or remote For local, we want to default to the same Python version as the current process. For remote, we want whatever is on offer. --- docs/api.rst | 2 +- mitogen/parent.py | 2 +- mitogen/ssh.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index b4e2e40b..0bb42ec2 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -485,7 +485,7 @@ Router Class :param str python_path: Path to the Python interpreter to use for bootstrap. Defaults to - ``python2.7``. In future this may default to ``sys.executable``. + :data:`sys.executable`. For SSH, defaults to ``python``. :param bool debug: If :data:`True`, arrange for debug logging (:py:meth:`enable_debug`) to diff --git a/mitogen/parent.py b/mitogen/parent.py index d1175838..9bc069bc 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -672,7 +672,7 @@ class Stream(mitogen.core.Stream): Base for streams capable of starting new slaves. """ #: The path to the remote Python interpreter. - python_path = 'python' + python_path = sys.executable #: Maximum time to wait for a connection attempt. connect_timeout = 30.0 diff --git a/mitogen/ssh.py b/mitogen/ssh.py index 36efbffc..eae70a36 100644 --- a/mitogen/ssh.py +++ b/mitogen/ssh.py @@ -103,6 +103,10 @@ class Stream(mitogen.parent.Stream): create_child = staticmethod(mitogen.parent.hybrid_tty_create_child) child_is_immediate_subprocess = False + #: Default to whatever is available as 'python' on the remote machine, + #: overriding sys.executable use. + python_path = 'python' + #: Number of -v invocations to pass on command line. ssh_debug_level = 0