This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author techtonik
Recipients techtonik
Date 2013-06-25.09:26:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This subprocess.communicate() call fails with pythonw.exe

import subprocess

hg = "hg"
output, _err = subprocess.Popen([hg, 'id', '-nib'],
open("-hg-", "w").write(output)

When is run with python.exe from cmd.exe session, the -hg- file is created ok. When pythonw.exe is used, nothing happens. When redirecting stderr from pythonw.exe with:

C:\Python27\pythonw.exe 2>1

1 contains the following stacktrace:
Traceback (most recent call last):
  File "", line 5, in <module>
  File "C:\Python27\lib\", line 672, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "C:\Python27\lib\", line 787, in _get_handles
    p2cread = self._make_inheritable(p2cread)
  File "C:\Python27\lib\", line 826, in _make_inheritable
WindowsError: [Error 6] The handle is invalid
Date User Action Args
2013-06-25 09:26:22techtoniksetrecipients: + techtonik
2013-06-25 09:26:22techtoniksetmessageid: <>
2013-06-25 09:26:22techtoniklinkissue18298 messages
2013-06-25 09:26:22techtonikcreate