Launching Python from Python
cliechti at mails.ch
Fri Jul 27 21:30:35 CEST 2001
do you realy need separate python interpreters?
you could "import" the other module and run the main function in a thread
look at the module "Threading".
something like that:
t = threading.Thread( target=test.main )
the test.main function runs then in the background
Jay O'Connor <oconnor at bioreason.com> wrote in
news:3B619A9E.9E940B28 at bioreason.com:
> I'm trying to launch another program from a Python program. The other
> program happens to be another Python program. I thought spawnle would
> be the proper place. However, it doesn't seem to be working.
> import os
> pid = os.spawnle (os.P_NOWAIT,
> my understanding is that this should spawn the other process, running
> the python runtime and passing in my script name.
> However, it doesn't quite happen. What happens is that it launches
> python in interactive mode. If I import sys, sys.path has my added path
> above, buy sys.argv is an array with one empty string.
> Any ideas why it doesn't work? Any other ideas on how to launch another
> python program from within one?
> This is on WinNT, BTW
> Take care,
> Jay O'Connor
> oconnor at bioreason.com
chris <cliechti at mails.ch>
More information about the Python-list