Subject: Re: bug#50514: 28.0.50; org inline call to python src block req C-g to break

From: "Barton, Mark" <[email-masked]>
Date: Tue, 14 Sep 2021 22:20:48 +0000

On Sep 14, 2021, at 12:31 PM, Augusto Stoffel <[email-masked]<mailto:[email-masked]>> wrote:

Great.  Then we'll fix the spurious line break problem, which is indeed
on the Emacs side.  But the other is due to ob-python, which may send
code to the interpreter before the first prompt is printed (this can be
checked through the variable 'python-shell--first-prompt-received').

Since I don't use org-babel, I'm afraid I can't help with that part…

So I found if I extend the sleep-for in ob-python from 10 ms to 90 ms, my initialization problem is “fixed”. I’m not sure why it would take longer than it did before the changes. Possibly an interaction with the antivirus software??? I have not tried other values, but may be there is a better method for ob-python to determine it is safe than using a sleep-for.

diff -u --label /Users/bartm002/.emacs.d/elpa/org-plus-contrib-20210913/ob-python.el --label \#\<buffer\ ob-python.el\> /Users/bartm002/.emacs.d/elpa/org-plus-contrib-20210913/ob-python.el /var/folders/kf/zdpzgs9d30b3jj4bdkdjf1vw0000gn/T/buffer-content-Kqgm3d
--- /Users/bartm002/.emacs.d/elpa/org-plus-contrib-20210913/ob-python.el
+++ #<buffer ob-python.el>
@@ -193,7 +193,7 @@
  (let ((python-shell-buffer-name
        (org-babel-python-without-earmuffs py-buffer)))
   (run-python cmd)
-  (sleep-for 0 10)))
+  (sleep-for 0 90)))
        ((and (eq 'python-mode org-babel-python-mode)
      (fboundp 'py-shell)) ; python-mode.el
  (require 'python-mode)

Diff finished.  Tue Sep 14 15:14:59 2021