[Twisted-Python] Processes in Twisted, only possible to run external prog?
Gabriel Rossetti
gabriel.rossetti at arimaz.com
Mon Sep 1 01:47:20 MDT 2008
glyph at divmod.com wrote:
> On 09:06 am, gabriel.rossetti at arimaz.com wrote:
>> http://www.biais.org/blog/index.php/2007/01/23/19-python-threads-and-
>> oschdir
>> http://bugs.python.org/issue1367
>>
>> 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?
>
> As it happens, "python" is an "external executable". Here's an
> example of spawning it in such a way as to make sure that sys.path is
> set properly:
> http://divmod.org/trac/browser/trunk/Epsilon/epsilon/process.py#L7
>
Ok, thanks
> However, Wine is also an external process. Perhaps you just want to
> spawn the Wine command-line using spawnProcess using the 'path'
> parameter set to a directory that you have created in the main
> process, then clean it up when the process exits?
>
> http://twistedmatrix.com/documents/8.1.0/api/twisted.internet.interfaces.IReactorProcess.spawnProcess.html
>
>
mmmm, yes, that sounds nice, I'll try that, thanks!
> Using fork() in Python has a lot of confusing issues associated with
> it unless you're going to exec() immediately afterwards. You probably
> want to stick to one of these other approaches.
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list