From Newsgroup: gnu.emacs.help
My objective is to save the current buffer.py, stop the REPL, start the
REPL and reload the buffer.py once again. Start over, in other words.
(defun python-save-send-buffer-to-repl ()
"I'm trying to restart the REPL and reload the current buffer"
(interactive)
(save-buffer)
(python-shell-send-string "quit()")
(run-python)
(python-shell-send-buffer)
(python-shell-switch-to-shell))
If I issue each one of these commands manually, it works. But the
procedure above doesn't. It seems that perhaps something happens too
fast invoked by the procedure above. Here's what I see in *Messages*:
--8<---------------cut here---------------start------------->8---
CanrCOt guess python-indent-offset, using defaults: 4
Sent: Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC
v.1932 64 bit (AMD64)] on win32...
comint-send-string: Writing to process: Invalid argument, Python --8<---------------cut here---------------end--------------->8---
I'm surprised to see the ``Sent: Python 3.10.6 [...]''. (This looks
like io-something that I don't understand.) That's the Python banner in
my system.
--8<---------------cut here---------------start------------->8---
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--8<---------------cut here---------------end--------------->8---
--- Synchronet 3.21d-Linux NewsLink 1.2