From a02df0366681c605902a425c7fa7260196925356 Mon Sep 17 00:00:00 2001 From: timor Date: Mon, 14 Aug 2017 16:03:08 +0200 Subject: [PATCH] Support relative python command strings --- ob-ipython.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ob-ipython.el b/ob-ipython.el index d27c920..16c53d0 100644 --- a/ob-ipython.el +++ b/ob-ipython.el @@ -166,11 +166,15 @@ procs))) (defun ob-ipython--launch-driver (name &rest args) - (let* ((python (locate-file (if (eq system-type 'windows-nt) - "python.exe" - (or python-shell-interpreter "python")) - exec-path)) - (pargs (append (list python "--" ob-ipython-driver-path) args))) + (let* ((command (if (eq system-type 'windows-nt) + "python.exe" + (or python-shell-interpreter "python"))) + (exec-path (if (and command (file-name-directory command)) + ;; If the command has slashes, make sure we + ;; first look relative to the current directory. + (cons default-directory exec-path) exec-path)) + (python (locate-file command exec-path)) + (pargs (append (list python "--" ob-ipython-driver-path) args))) (ob-ipython--create-process name pargs) ;; give kernel time to initialize and write connection file (sleep-for 1)))