Are you asking about this?
Windows: When executing Python scripts on the command line using file type
associations (i.e. starting “script.py” instead of “python script.py”),
redirects may not work unless you set a specific registry key. See
the Knowledge Base article STDIN/STDOUT Redirection May Not Work If Started from a File Association.
It’s in the Python README. Perhaps this patch is what you’re looking for.