[Twisted-Python] Processes in Twisted, only possible to run external prog?
gabriel.rossetti at arimaz.com
Fri Aug 29 05:45:53 EDT 2008
Maarten ter Huurne wrote:
> On Friday 29 August 2008, Gabriel Rossetti wrote:
>> 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 :
> Maybe you could bypass this problem by generating a short shell script that
> does "cd" before it starts Wine? Since the shell will be a separate
> process, it has its own working dir.
I'd rather not, because that would mean implementing everything (the
whole conversion process) in the script.
I have stuff to do before the conversion,preparations, those could be
done in the script, and after : parsing output,
filter and modify the data & then write the new data in binary form --
which is harder to do from a non-python shell script.
Maybe I could use a standalone python shell script? Is there no other
More information about the Twisted-Python