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--


When testhg.py 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 testhg.py 2>1

1 contains the following stacktrace:
Traceback (most recent call last):
  File "testhg.py", line 5, in <module>
    stdout=subprocess.PIPE).communicate()
  File "C:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "C:\Python27\lib\subprocess.py", line 787, in _get_handles
    p2cread = self._make_inheritable(p2cread)
  File "C:\Python27\lib\subprocess.py", line 826, in _make_inheritable
    _subprocess.DUPLICATE_SAME_ACCESS)
WindowsError: [Error 6] The handle is invalid

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18298>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to