Detect how I run Python script
How do I detect if a script is run from a Windows console or fro开发者_StackOverflow中文版m Komodo debugger without passing different arguments to the script?
Although I don't know Komodo, I don't think its standard input is interactive, so you could try
import sys
in_console = sys.__stdin__.isatty()
in_console will then be true if the invoker provides interactive stdin and you will get what you want, though not in an elegant way.
加载中,请稍侯......
精彩评论