Determine how I run the Python script

How to determine if a script is being executed from the Windows console or from the Komodo debugger without passing various arguments to the script?

+3
source share
1 answer

Although I don’t know Komodo, I don’t think its standard input is interactive, so you can try

import sys
in_console = sys.__stdin__.isatty()

in_consoletrue if invoker provides interactive stdinand you get what you want, albeit not elegantly.

+4
source

All Articles