[Twisted-Python] Processes in Twisted, only possible to run external prog?

Gabriel Rossetti gabriel.rossetti at arimaz.com
Fri Aug 29 05:06:59 EDT 2008

Hello everyone,

Here's the problem : I need to run a windows executable (proprietary, 
they won't give us the code) with wine to do some audio compression. I 
need to do different processing before (like calling sox, or parsing 
files, etc) so I wrote some functions that do everything. The windows 
exec creates a tmp file named "_tmp" in the working dir, so if I want to 
run several in parallel, I have to create a tmp dir with a unique name 
and change the working dir, if not then the multiple executions will 
overwrite each other's tmp file. So when I call my function that does 
the whole process, I first create a tmp dir, then pass it the tmp dir 
and the input filename, then once inside the function, it does an 
os.chDir() into the tmp dir and at the end it does it again to go back 
to the original current dir. Then I run that function in threads. The 
problem is that threads share the current dir :



so I need to use processes instead, as they each have their own current 
dir. The thing is that from what I understand, Twisted's process API is 
intended to be used with external executables only, correct? I wasn' t 
able to fins anything that allowed me to do stuff like I would using 
fork(). Should I just use python's fock() instead? Is it safe with Twisted?

Thank you,

More information about the Twisted-Python mailing list