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

From: Mark Barton <[email-masked]>
Date: Sat, 27 Aug 2022 14:31:33 -0700

> On Aug 27, 2022, at 11:59 AM, Barton, Mark <[email-masked]> wrote:
> 
>  
> 
>> On Aug 27, 2022, at 7:11 AM, Ihor Radchenko <[email-masked]> 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
> 
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