[Twisted-Python] Unpedictable behaviour of transport.write call: Problem with return the control to reactor

Phil Mayers p.mayers at imperial.ac.uk
Wed Nov 4 08:13:36 EST 2009


naman jain wrote:
> Hi,
> 
> I was trying this out:
> 
> 
> Server code:
> 
> def dataReceived(self, data):
>     if (args["cmd"] == "CHECK_IN"):
>         foo = subprocess.Popen('python master.py',shell = True)
>         /# this ACK notifies the client to close the connection/
>         self.transport.write( self.create_message("CHECK_IN","ACK") )
> 
> I use the subprocess call , as I want to avoid threads here, and 
> independently launch my master.py without blocking this code.
> I dont aim to have any interaction with the master.py once it is launched

Don't do that. Use:

twisted.python.utils.getProcess*

...which return a deferred and work with the reactor, rather than 
against or outside it.



More information about the Twisted-Python mailing list