[Twisted-Python] Suppressing terminal window from reactor.spawnProcess?

Steve Freitas sflist at ihonk.com
Fri Feb 2 20:57:46 EST 2007

On Fri, 2007-02-02 at 19:07 -0600, Eric Mangold wrote:
> It's better to control the parent process. You can easily use  
> CreateProcess yourself, and use OpenProcess followed by TerminateProcess  
> to kill it. All these functions are in pywin32 which you already have if  
> you're using spawnProcess.
> You *can*, however, close the console after it's created. Just call  
> FreeConsole(). This will have the effect of flashing a console window on  
> the screen for a split second. Depending on how you run your service it  
> may not have access to the desktop, and I'm not sure if this will cause  
> problems with launching processes that try to create console windows.
> Alternatively, since this is python, and you don't care about I/O, you can  
> use pythonw.exe instead.

Thanks! It did. I'm not launching a Python process, but I mistakenly
assumed that Python's built in process launching functions were
blocking, so I didn't bother looking any further when I had
spawnProcess() staring at me.

I decided to use subprocess.Popen(shell=False), and that did it.
However, I've just determined that I need access to stderr after all --
apparently I need to be apprised of errors from stderr during the
process's execution -- so I'm hoping I can figure out a way to do that
within what I'm using now. Time to get some experience creating
file-like objects, I suppose.


More information about the Twisted-Python mailing list