Can module tell if running from interpreter vs Windows command line ?

alex23 wuwei23 at gmail.com
Wed Jul 15 20:47:39 EDT 2009


On Jul 16, 10:41 am, alex23 <wuwe... at gmail.com> wrote:
> It's recommended that you search through the list for similar
> questions before posting.

Of course, it's even MORE important that one actually ensures they're
responding to the _same_ question before pointing at an answer...

This older post should help:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/6c587ba377ae045a/0df10b077f5ee5d4

But the quick answer is to import sys into your program, and do a test
on hasattr(sys, 'ps1'), which is only created when running the
interactive prompt.



More information about the Python-list mailing list