tags:

views:

71

answers:

2

When programming in the two IDEs i used, bad things happen when i use raw_input. However on the command line it works EXACTLY how i expect it to. Typically this app is ran in cmd line but i like to edit and debug it in an IDE. Is there a way to detect if i executed the app in an IDE or not?

+3  A: 
if sys.stdin.isatty():
   # command line (not a pipe, no stdin redirection)
else:
   # something else, could be IDE
J.F. Sebastian
A: 

I would strongly advise (and you have been previously advised on this) to use a good IDE, and a good debugger instead of hacking around your code to fix something that shouldn't be broken in the first place.

I deserve to be down-voted for not answering the question, but please consider this advice for your future sanity.

I would personally recommend Winpdb debugger and PIDA IDE

Ali A