Newbie question - input doesn't work in Emacs python-mode

Alfred Morgan amorgan at
Tue Feb 18 19:20:20 CET 2003

I'm surprised nobody gave you the answer yet.

Here are the two commands you will be using:
	C-c !           py-shell
	C-c C-c         py-execute-buffer

You are getting an EOF because you do not have a buffer you can type in. 
   executing py-execute-buffer by its self will only show you output, if 
any. If you execute the command py-shell first this will open a buffer 
you can type in.  Then execute py-execute-buffer on your program.  It 
will now use the buffer *Python* that py-shell opened to execute your 
program with input as you would expect it.


K. Fleming wrote:
> John Ochiltree <johnochiltree at> writes:
>>K. Fleming wrote:
>>>I just started fooling around with Python and so far have enjoyed it
>>>immensely.  However, I came across a problem when using Emacss
>>>python-mode.  The following line
>>>answer = input("Will this work?")
>>>will not work.  It generates the error
>>>EOFError: EOF when reading a line
>>>It works fine when I try to run it in IDLE however.  Can anyone help
>>>me?  Thanks to all who respond.
>>Using xemacs and python 2.3 I haven't been able to break it. As it works 
>>fine, what relevant versions are you using?
> GNU Emacs 21.2.1, Python 2.3
> I noticed something strange, however: when I open the Python
> interpreter from Emacs and type in the same line, it works fine.
> However, when I choose to "execute buffer", the EOFError occurs.  I
> have a feeling that Emacs is doing something behind my back...

More information about the Python-list mailing list