anatoly techtonik added the comment:
I am not using pythonw.exe, it is the option users prefer to run the program.
pythonw.exe is a binary, how do you propose to patch that? Or is it translated
to .exe with RPython?
Can you be more specific what shell does not work correctly, what exactly
Amaury Forgeot d'Arc added the comment:
RPython... let's be serious. The code of pythonw.exe is very simple, see
PC/WinMain.c.
No, pythonw.exe is not meant to suppresses the terminal window on startup.
This is only a consequence of being a windows application. There is a lot of
documentation
Changes by anatoly techtonik techto...@gmail.com:
--
components: +Windows
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
___
___
Changes by anatoly techtonik techto...@gmail.com:
--
title: pythonw.exe fails with redirected stdett - pythonw.exe fails with
redirected stderr
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
anatoly techtonik added the comment:
This subprocess.communicate() call fails with pythonw.exe
--cut testhg.py--
import subprocess
hg = hg
output, _err = subprocess.Popen([hg, 'id', '-nib'],
stdout=subprocess.PIPE).communicate()
open(-hg-, w).write(output)
--cut testhg.py--
anatoly techtonik added the comment:
This was meant to be a separate issue. :/
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
___
___
Amaury Forgeot d'Arc added the comment:
Yes, in pythonw.exe the C stderr is not really usable, and this leads to
unpredictable results.
It's difficult to fix in python2 though; python3 has fixed this issue, but in a
way that cannot be backported.
Some workarounds:
- don't use pythonw.exe in a
anatoly techtonik added the comment:
It is not about modifying Python in general, it is about patching pythonw.exe
or subprocess or documenting how to make subprocess calls compatible with
pythonw.exe
don't use pythonw.exe in a console
And how to debug the issue? Maybe the only solution in
Amaury Forgeot d'Arc added the comment:
The proper solution if you use pythonw.exe is to define sys.stdout/sys.stderr
yourself in pythonw.exe::
sys.stdout = open('c:/temp/output.txt', 'w')
IOW, do the redirect from inside the program, don't rely on the shell which (by
design?) does not