Problem with Emacs mode, at start only

Alex alex at somewhere.round.here
Thu Feb 17 11:39:13 EST 2000


> When, in Emacs, I do not have `*Python*' window initialised, or more
> precisely, when there is no process running in that window, then `C-c
> C-c' in the window where is the Python source invariably fails the
> first time, with the diagnostic below.  Repeating the command a second
> time works as expected, and the next times as well, as long as the
> Python sub-process does not terminate.  

Hi, Francois.  Adding something like the following code to your .emacs
file might go some way to solving your problem.  Actually, it's been a
bit of a pain for me, too, but I didn't realize it until I read your
post.  :)

(add-hook 'python-mode-hook '(lambda ()
			       (save-window-excursion
				 (py-shell)
				 (local-unset-key "\C-c\C-c")
				 (local-set-key "\C-c\C-s"
						'comint-interrupt-subjob))))

This automatically starts the python shell whenever you go into
python-mode, and rebinds what used to be C-c C-c to C-c C-s.  You will
still have to switch to the python shell in order see the results of
executing your code, though.

Hope this helps.
Alex.



More information about the Python-list mailing list