Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect how I run Python script

Tags:

python

windows

How do I detect if a script is run from a Windows console or from Komodo debugger without passing different arguments to the script?

like image 887
Pablo Avatar asked Apr 08 '26 09:04

Pablo


1 Answers

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.

like image 91
Evpok Avatar answered Apr 10 '26 22:04

Evpok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!