#6781 defect new
twisted reactor.spawnProcess opens an unwanted console on windows when cx_freeze'd
|Reported by:||gianmt||Owned by:|
when I run the code from a console (on Windows) the child process runs without opening another console, but when I run the code from the cx_freeze'd app another console opens.
I found this old thread where was suggested to use FreeConsole(), it will flash the console on screen for a blink but I can eventually live with it, unfortunately if i understood correctly it should be called from the child process.
I also found this ticket (7yo) on a re-factoring of the whole spawnProcess on windows but apparently it never happened:
I have no control over the code of the child process, so doing something there is unfortunately not an option, but even if I did the process I'm spawning it's a console app and I believe FreeConsole() could not be called there or the process will terminate.
Glyph @stackoverflow suggested the following:
What happens when you run the code from the GUI with Python, but without cx_Freeze involved? You should be able to test this if you have Python installed by simply putting your code into a .pyw file and double-clicking on it in Explorer.
If this still pops up a console window when you run your subprocess, then this is totally a bug in Twisted and you should file it as such. Eric's answer in that mailing list message is wrong; if you want to spawn processes with spawnProcess they definitely shouldn't be popping up random console windows.
I can confirm that cx_freeze isn't doing anything wrong, even using pythonw spawns a console window, having a useConsole flag for spawning processes on windows would be great.
Change History (5)
comment:2 Changed 3 years ago by gianmt
- Summary changed from twisted reactor.spawnProcess opens an unwanted console when cx_freeze'd to twisted reactor.spawnProcess opens an unwanted console on windows when cx_freeze'd