I found this issue while redirecting the error stream in python:
import sys file = open("log", "w") sys.stderr.write = file.write variable
now as variable is not defined I must get a NameError, but when I run the script I get the file “log” but it doesn’t contain any value. The file is empty. I think so this is a bug because I got this code from stack overflow, it worked for many people but not for me.
This most likely is a bug in python 3.10.0 (I’m using python 3.10.0) so I posted this here instead of stack overflow, but before reporting I want to be sure this is a bug not my code’s problem.