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

From: "Barton, Mark" <[email-masked]>
Date: Sun, 12 Sep 2021 08:27:23 +0000

On Sep 11, 2021, at 11:51 PM, Augusto Stoffel <[email-masked]<mailto:[email-masked]>> wrote:

Okay, I opened a bug in Org mode linking to this ticket and suggesting
the solution https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Forgmode.org%2Flist%2F875yv61ej9.fsf%40gmail.com%2FT%2F%23u&amp;data=04%7C01%7CMark.Barton%40disney.com%7Cf0ed3506c5a84b98ec2408d975b9b53c%7C56b731a8a2ac4c32bf6b616810e913c6%7C1%7C0%7C637670262742236357%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=DH%2BaAGp7m%2BddApEMkeWBmAJ%2FXLIWxJy7oCVxG1oFItc%3D&amp;reserved=0

As to the problem still you have when starting up the shell, I can't
observe it (but I am not able to test on macos).  Does it happen when
you just call `M-x run-python' from emacs -Q?  And does it persist if you
do
 (setq python-shell-completion-native-enable nil)
?

Augusto,

If I  (setq python-shell-completion-native-enable nil) then I don’t get a message about the completion in the echo area, but I still need to do C-g to break out in order to send any commands (keystrokes) to emacs.

If I run emacs -Q and then open that org file and run M-x run-python. Then it opens Inferior Python in a buffer *Python* and emacs is responsive and so is the python shell. I noted earlier that if I don’t use the session naming, then simple cases work where I don’t need multiple src blocks to share an environment.

This time I tried setting “Enter Debugger on Quit/C-g” from the Option menu in Emacs. This is what I get when I pressed C-g to get control of Emacs after the first C-c C-c to evaluate call_file_date inline function.

Debugger entered--Lisp error: (quit)
  org-babel-python--send-string("*python-chain*" "with open('/var/folders/kf/zdpzgs9d30b3jj4bdkdjf1v...")
  org-babel-python-evaluate-session("*python-chain*" "print(\"testing2\", end=\"\")" output ("replace" "output"))
  org-babel-python-evaluate("*python-chain*" "print(\"testing2\", end=\"\")" output ("replace" "output") nil)
  org-babel-execute:python("print(\"testing2\", end=\"\")" ((:colname-names) (:rowname-names) (:result-params "replace" "output") (:result-type . output) (:results . "replace output") (:exports . "results") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "python-chain")))
  org-babel-execute-src-block(nil ("python" "print(\"testing2\", end=\"\")" ((:results . "output replace") (:exports . "results") (:session . "python-chain") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) nil nil 359 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  command-execute(org-ctrl-c-ctrl-c)