Subprocess, WindowsError: handle invalid

1,002 views
Skip to first unread message

Esteban Castro Borsani

unread,
Oct 8, 2012, 3:13:34 PM10/8/12
to pyins...@googlegroups.com
HI! so, i'm facing this issue when trying to run an exe using subprocess.Popen from an python module.

This is the structure of my project:

--Root
----myApp.exe
----mypackage (python package)
---------script.py
---------Folder (some folder)
-------------some_script.exe

myApp.exe (the app frozen by pyinstaller), imports and calls script.py
script.py calls subprocess.Popen([get_path(), '-a', fh.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Traceback (most recent call last):

File "C:\Users\Admin\Desktop\0.8.0\ochDownloader\addons\swfdump\dump.py", line 20, in get_swf_dump

p = subprocess.Popen([get_path(), '-a', fh.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

File "C:\Users\Admin\Desktop\pyinstaller-2.0\pyinstaller-2.0\starter\build\pyi.win32\starter\out00-PYZ.pyz\subprocess", line 672, in __init__

File "C:\Users\Admin\Desktop\pyinstaller-2.0\pyinstaller-2.0\starter\build\pyi.win32\starter\out00-PYZ.pyz\subprocess", line 774, in _get_handles

WindowsError: [Error 6] Controlador no válido


subprocess.call works properly, dont know why Popen does not.


Esteban Castro Borsani

unread,
Oct 8, 2012, 6:00:46 PM10/8/12
to pyins...@googlegroups.com
I almost forget, Im running pyinstaller 2.0 (also tried the development version), python 2.7, Windows 7 x86.
I'm packing my application as a single file.

Hartmut Goebel

unread,
Oct 8, 2012, 6:22:02 PM10/8/12
to pyins...@googlegroups.com
Am 09.10.2012 00:00, schrieb Esteban Castro Borsani:
I almost forget, Im running pyinstaller 2.0 (also tried the development version), python 2.7, Windows 7 x86.
I'm packing my application as a single file.

Please try
a) packaging in --onedir mode
b) creating a minimal example for reproducing this problem.

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP

Goebel Consult
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/2011-09-kommerz-uber-recht-fdp-die-gefaellt-mir-partei
Blog: http://www.goebel-consult.de/blog/20050620

Goebel Consult ist Mitglied bei http://www.7-it.de/

Esteban Castro Borsani

unread,
Oct 29, 2012, 9:18:59 AM10/29/12
to pyins...@googlegroups.com
I did not make the time to test want you ask. But I just want it to say I solve my issue by creating a new console window.

http://code.activestate.com/recipes/578300-python-subprocess-hide-console-on-windows/





On Monday, October 8, 2012 4:13:34 PM UTC-3, Esteban Castro Borsani wrote:

Martin Zibricky

unread,
Oct 29, 2012, 10:00:25 AM10/29/12
to pyins...@googlegroups.com
Esteban Castro Borsani píše v Po 29. 10. 2012 v 06:18 -0700:
> I did not make the time to test want you ask. But I just want it to
> say I solve my issue by creating a new console window.
>
> http://code.activestate.com/recipes/578300-python-subprocess-hide-console-on-windows/

Hi Esteban,

could you please provide more info? How could be a proper fix
incorporated into pyinstaller?

Esteban Castro Borsani

unread,
Oct 30, 2012, 10:34:57 PM10/30/12
to pyins...@googlegroups.com
Nevermind, what actually solved the issue was setting "console" and/or "debug" to True in the spec file.

Also, I found this solution and it does works: http://stackoverflow.com/questions/10290990/subprocess-popen-not-working-with-pythonw-exe

Passing the stdin=subprocess.PIPE parameter does the trick.




On Monday, October 8, 2012 4:13:34 PM UTC-3, Esteban Castro Borsani wrote:

Esteban Castro Borsani

unread,
Oct 30, 2012, 10:57:42 PM10/30/12
to pyins...@googlegroups.com
It seems to be a bug in pythonw.exe: http://bugs.python.org/issue3905

I guess when "console" and/or "debug" are set to True, python.exe is used, if they are set to False pythonw.exe is used instead?
Reply all
Reply to author
Forward
0 new messages