emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix ob-python.el initiate session error with py-shell
@ 2020-02-18 12:55 stardiviner
  2020-02-18 13:07 ` Bastien
  2020-02-18 17:07 ` Jack Kamm
  0 siblings, 2 replies; 14+ messages in thread
From: stardiviner @ 2020-02-18 12:55 UTC (permalink / raw)
  To: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 504 bytes --]


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
      

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-lisp-ob-python.el-org-babel-python-initiate-session-.patch --]
[-- Type: text/x-patch, Size: 1100 bytes --]

From fa39b7f3ad8aafe0fcebb27c5f695edf08820884 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-02-22 14:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 12:55 [PATCH] Fix ob-python.el initiate session error with py-shell stardiviner
2020-02-18 13:07 ` Bastien
2020-02-18 17:07 ` Jack Kamm
2020-02-18 17:18   ` Jack Kamm
2020-02-18 20:23     ` Bastien
2020-02-19  7:38     ` numbchild
2020-02-19 15:51       ` Jack Kamm
2020-02-19 16:03         ` Bastien
2020-02-20  5:45         ` stardiviner
2020-02-20 16:26           ` Andreas Röhler
2020-02-20 17:46             ` Bastien
2020-02-20 18:51               ` Jack Kamm
2020-02-20 19:08                 ` Bastien
2020-02-22 14:28               ` stardiviner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).