How do I tell if I'm running in the PyWin interpreter?

vincent wehren vincent at
Sat Jan 28 08:21:45 EST 2006

"Charles Krug" <cdkrug at> schrieb im Newsbeitrag 
news:M_mdnUt34fVAbkfeRVn-pQ at
| On 2006-01-28, Steven D'Aprano <steve at> wrote:
| >>
| >> As the comment says, when I run this under Python Win, I get an (pretty
| >> sure) Tkinter interface, not a command line, and I don't get my
| >> EOFError when I expect to.
| >
| > When do you expect to get an EOFError? The only way I get an EOFError is
| > if I explicitly hit Ctrl-D while raw_input is running. When do you 
| > to get it? Have you tried Ctrl-Z under Windows?
| >
| That's exactly how I use it everywhere else.  Type until you're done
| then hit <Ctrl-D>
| The problem is only when running under the PyWin IDE . . I'd been using
| this for months under Idle and every place else I needed it.
| The problem is that PyWin doesn't give you a raw command line with in
| response to raw_input, but gives you a text entry box and a nice
| OK-Cancel yada yada interface that silently eats my EOF.
| I'd like to have a single tool I can use everywhere.  So far as I can
| tell, that means I have to detect the PyWin IDE and handle it
| separately on initialization so I get a real raw input and not the
| redefined Tkinter version.

import sys
import os
if os.path.basename(sys.executable) == 'Pythonwin.exe':
    #Pythonwin specific  initialization


Vincent Wehren

More information about the Python-list mailing list