subprocess "handle is invalid" error

Grant Edwards grante at
Wed Apr 18 17:21:29 CEST 2007

I'm trying to use the py-gnuplot module on windows, and have
been unable to get it to work reliably under Win2K and WinXP.

By default, it uses popen(gnuplotcmd,'w'), but in some
situations that consistently gets an "invalid operand" IOError
when write() is called on the pipe.

So I switched to subprocess.  It works fine when executed
"normally" (e.g.  "python"), but when bundled by
py2exe, it always does this:

  Traceback (most recent call last):
    File "", line 28, in ?
    File "Gnuplot\_Gnuplot.pyc", line 178, in __init__
    File "Gnuplot\gp_win32.pyc", line 117, in __init__
    File "subprocess.pyc", line 533, in __init__
    File "subprocess.pyc", line 607, in _get_handles
    File "subprocess.pyc", line 634, in _make_inheritable
  WindowsError: [Errno 6] The handle is invalid

How does one troubleshoot errors that happen three layers deep
in the subprocess module?

Grant Edwards                   grante             Yow! I'm a fuschia bowling
                                  at               ball somewhere in Brittany

More information about the Python-list mailing list