nothing happens because it is waiting for input
And this is completely normal. You want to fix something that does not require any corrections, and as a by-product that you are actually creating.
Imagine a pipeline process that does some heavy calculations, and because of this, it takes some time to output the result. You cannot check data availability in your python script. You do not know when the data will be available. You must be patient.
So, I want to check (when running the script) if there is input from the pipe or not.
not to do. If for some reason your application is not designed to run with tty (waiting for user input), check this out.
sys.stdin.isatty()
Check only the availability of data if there is some kind of strict restriction: for example, the user must respond within 2 seconds.
Karoly Horvath
source share