When I have a python src block like this:

#+begin_src python :session "test" :results output
print("hello, world")
#+end_src

It will report session error.

This minor patch should fixed ~py-shell~ initiate Python session issue.

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
From fa39b7f3ad8aafe0fcebb27c5f695edf08820884 Mon Sep 17 00:00:00 2001
From: stardiviner <numbch...@gmail.com>
Date: Tue, 18 Feb 2020 20:52:32 +0800
Subject: [PATCH] * lisp/ob-python.el
 (org-babel-python-initiate-session-by-key):

fix ob-python.el initiate session issue.
---
 lisp/ob-python.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index de718b04b..f67acf2f9 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -207,8 +207,8 @@ (defun org-babel-python-initiate-session-by-key (&optional session)
 			     "^\\*\\([^*]+\\)\\*$" "\\1" python-buffer)
 			  (concat "Python-" (symbol-name session))))
 	       (py-which-bufname bufname))
-	  (py-shell)
-	  (setq python-buffer (org-babel-python-with-earmuffs bufname))))
+	  (setq python-buffer (org-babel-python-with-earmuffs bufname))
+	  (py-shell nil nil t org-babel-python-command python-buffer nil nil t nil)))
        (t
 	(error "No function available for running an inferior Python")))
       (setq org-babel-python-buffers
-- 
2.25.0

Attachment: signature.asc
Description: PGP signature

Reply via email to