On Aug 27, 2022, at 7:11 AM, Ihor Radchenko <yantar92@gmail.com> wrote:

---
lisp/ob-python.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 932aca08e..2ad907bd8 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -197,8 +197,7 @@ (defun org-babel-python-initiate-session-by-key (&optional session)
  (setq py-buffer (org-babel-python-with-earmuffs session)))
(let ((python-shell-buffer-name
       (org-babel-python-without-earmuffs py-buffer)))
-   (run-python cmd)
-   (sleep-for 0 10)))
+   (run-python cmd)))
       ((and (eq 'python-mode org-babel-python-mode)
     (fboundp 'py-shell)) ; python-mode.el
(require 'python-mode)
@@ -225,8 +224,9 @@ (defun org-babel-python-initiate-session-by-key (&optional session)
(defun org-babel-python-initiate-session (&optional session _params)
  "Create a session named SESSION according to PARAMS."
  (unless (string= session "none")
-    (org-babel-python-session-buffer
-     (org-babel-python-initiate-session-by-key session))))
+    (let ((session (org-babel-python-session-buffer
+                    (org-babel-python-initiate-session-by-key session)))))
+    (org-babel-comint-wait-for-output session)))

(defvar org-babel-python-eoe-indicator "org_babel_python_eoe"
  "A string to indicate that evaluation has completed.")
-- 
2.35.1

I get the following in the Messages:
org-babel-comint-wait-for-output: Buffer python-chain does not exist or has no process

Note that python-chain is the name of my session passed to the python blocks as shown in the following line within my org file.

#+PROPERTY: header-args:python :session python-chain :exports results :results raw file :file-ext table

Thanks,

Mark