I am writing a bash script that will be called from cron.
The bash script runs a python command that is sensing when it's in a terminal by using pythons os.isatty function and outputs different things depending on if it's run manually or via a cron. This is making debugging very hard and I would like to make it so that it always assumes it ISN'T in a TTY.
I would like to be able to add something to the bash script to fool the python script that it is not being run in a terminal and so always output the same thing.
To confirm, I have control of the bash script but don't want to edit the python as this is a packaged app.
Any ideas?
I hope that made sense.
Thank you very much in advance.
You can redirect the output to cat
(assuming the script tests sys.stdout
's file descriptor's atty
-ness).
python myscript.py | cat
a.py
import sys
print sys.stdout.isatty()
to test:
> python a.py
True
> python a.py | cat
False
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With