Cody Blog

Process handle is invalid in Python

Error

Tool.py", line 97, in __funcExecCmd

    intResult = subprocess.call(strCmd, stdout=output, stderr=output)

  File "C:\Python26\lib\subprocess.py", line 470, in call

    return Popen(*popenargs, **kwargs).wait()

  File "C:\Python26\lib\subprocess.py", line 616, in __init__

    errread, errwrite) = self._get_handles(stdin, stdout, stderr)

  File "C:\Python26\lib\subprocess.py", line 724, in _get_handles

    p2cread = self._make_inheritable(p2cread)

  File "C:\Python26\lib\subprocess.py", line 763, in _make_inheritable

    _subprocess.DUPLICATE_SAME_ACCESS)

WindowsError: [Error 6] The handle is invalid

Solution

Add stdin = subprocess.PIPE in subprocess.call()

windows

Comments