Can't exit python with ^D under certain circumstances

Steve Holden sholden at
Fri Dec 28 11:33:43 EST 2001

"wealthychef" <wealthychef at> wrote in message
news:mailman.1009322789.23019.python-list at
> Hi, this is weird to me, don't know how to fix.
> On my local python installation on machine A in a normal shell, ^
> D works to exit Python as expected.  On machine B on the
> console, ^D also works fine, but if I ssh to machine B from
> machine A and try to exit Python with ^D, Python does not exit,
> instead I get the following strange error message:
> >>> ^D
>   File "<stdin>", line 1
>     c
>     ^
> SyntaxError: invalid syntax
> What is printing here as a little 'c' is showing up in the terminal
> as maybe
> E
>  F
> crammed into one character, or
> F
>  F
> I can't quite read it.
> Can anyone help me?  I'm no xmodmap dude, but i suspect
> some sort of keyboard confusion.  The two systems are different.
> Machine A is running one flavor of Unix, and machine B is
> running another, each with radically different hardware.
> Is there another way to exit Python?  Workaround?  Fix?  Thanks.
The "E and F rammed into a single character" sounds like a representation of
"EOF" as a graphic. The real question is why the end of file you send to
your local ssh client doesn't make it through to the Python interpreter as
an EOF, but instead (apparently) gets transmitted as a character.

In the meantime, you can terminate the interpreter with something like:

    import sys
    sys.exit("No more Python!")


More information about the Python-list mailing list