GNU bug report logs - #50514
28.0.50; org inline call to python src block req C-g to break

Previous Next

Package: org-mode;

Reported by: "Barton, Mark" <Mark.Barton <at> disney.com>

Date: Fri, 10 Sep 2021 23:13:01 UTC

Severity: normal

Full log


Message #81 received at 50514 <at> debbugs.gnu.org (full text, mbox):

From: "Barton, Mark" <Mark.Barton <at> disney.com>
To: Ihor Radchenko <yantar92 <at> gmail.com>
Cc: "50514 <at> debbugs.gnu.org" <50514 <at> debbugs.gnu.org>,
 Mark Barton <mbarton98 <at> gmail.com>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Augusto Stoffel <arstoffel <at> gmail.com>
Subject: Re: bug#50514: 28.0.50; org inline call to python src block req C-g
 to break
Date: Sun, 28 Aug 2022 00:38:18 +0000
[Message part 1 (text/plain, inline)]
I will work on getting more details this weekend. It looked like the buffer passed to org-babel-comint-wait-for-output was missing the "earmuffs". I tried adding the earmuffs with the org function for that but although I got passed that error, I messed up my python session and the following python blocks were not aware of the imports in the first block.

Mark



I tried something that was suggested last September 14th by Augusto Stoffel. I had not tried it because changing the sleep from 10 to 90 was my workaround.
One thing that might work is to block until the shell is ready with something like

    (run-python)
    (with-current-buffer *the-shell-buffer*
      (while (not python-shell--first-prompt-received)
        (accept-process-output (get-buffer-process (current-buffer)))))

The patch that is working for me now is:

modified   lisp/org/ob-python.el
@@ -198,7 +198,10 @@ org-babel-python-initiate-session-by-key
  (let ((python-shell-buffer-name
        (org-babel-python-without-earmuffs py-buffer)))
   (run-python cmd)
-  (sleep-for 0 10)))
+          (with-current-buffer py-buffer
+            (while (not python-shell--first-prompt-received)
+              (accept-process-output (get-buffer-process (current-buffer)))))
+          ))
        ((and (eq 'python-mode org-babel-python-mode)
      (fboundp 'py-shell)) ; python-mode.el
  (require 'python-mode)

[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 292 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.