"Barton, Mark" writes: > 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))))) Thanks, but it is not a good solution. Org cannot rely on internal variables inside python.el (python-shell--first-prompt-received is an internal variable). Internal variables are a subject of change without notice. May you instead try the attached alternative patch? -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92