Where does my Python output go when I start Blender with a script in Windows? I'm starting Blender 2.79 with a --python flag to run a python script.

On a Mac, print() statements show up in the terminal window as expected. On Windows, when executing the same command in git bash, print() statements appear until the main Blender window opens and then output stops.

Where does console output go says on Windows output should go to the "Console Window," but when I select this menu option, the main Blender window loses focus and nothing else happens. (If I start Blender normally the Console Window appears as expected.)

Things that didn't work for me:


Writing to the console: How can I display what happens in the system console inside blender&#39;s console?
Starting blender.exe with the -con flag


Things that kind of worked:


Overriding print() as in Blender script run print to console works but only after I quit Blender. -_-
The redirect_stdout trick from How to redirect output from &#39;bpy.ops.*&#39;? prints output if I capture it with stdout.seek(0); print(stdout.read()), but only after I quit Blender. -_-
os.system('echo test') works, but if it's possible to get regular python print statements working I'd like to know how.
Git Bash is different from regular terminals, as it tries to bridge the gap in behaviour between UNIX terminals and Windows' console (cmd.exe). Run winpty ./blender.exe to get more immediate output of your print() commands.

Note, however, that winpty seems to mangle filenames, so you have to resort to absolute paths in Windows notation to prevent this.