I would like to know the logic behind the order of the outputs in Python 3. For example:
test.py:
import sys
print("my stdout", file=sys.stdout)
print("my stderr", file=sys.stderr)
I want both outputs in the same file.
I run the code with this command:
python3 test.py 1>all_outputs.txt2>&1
I was expecting to obtain the following output:
all_outputs.txt:
my stdout
my stderr
But the result in:
my stderr
my stdout
So why did the error come in first ?