In a bash script, I can access the pipes interchangeably. If I would like to do this from within a python script, how would I go about accessing sys.stderr
?
Currently, I am doing the following:
#/usr/bin/env python
import sys
std_input = sys.stdin.readlines()
std_error = sys.stderr.readlines() # <-- fails, complaining that the file is
# not open for reading.
And I call the code from within a bash script:
#/usr/bin/env bash
... | ./python-script.py
Where there exists both stdin
and stderr
content on the pipeline streaming into the python-script.py
command.
There is no need for concurrency or anything fancy.