By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,594 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,594 IT Pros & Developers. It's quick & easy.

Re: Spawning a new UI process

P: n/a
Ed Leafe wrote:
I'm working on a wxPython app (well, a Dabo app, but it's basically
the same thing) that presents the user with a selection of several
wxPython apps that exist on their system. They choose one, and I want to
then "launch" that app, as if they had typed "python myapp.py" from a
terminal window. The initial app can either terminate or continue;
that's not terribly important. The important thing is to get the
selected app to run in a separate process.

I've tried all the variants of os.spawn* and os.exec*, without
success. Either nothing happens, or a Python interpreter is opened in
the Terminal window I used to run the launcher. I want to do something
like:

cd (appdir)
pth = os.path.join(os.getcwd(), "main.py")

followed by one of:

os.spawnl(os.P_NOWAIT, "main.py")
os.spawnl(os.P_NOWAIT, pth)
os.spawnl(os.P_NOWAIT, "python", pth)
os.spawnl(os.P_NOWAIT, "python", "main.py")
os.spawnl(os.P_NOWAIT, "/usr/bin/python", pth)
os.spawnl(os.P_NOWAIT, "/usr/bin/python", "main.py")

The only result I've gotten is a Python interpreter is started, but
the GUI app that should be launched by 'main.py' is never run.

So what am I missing? How do I launch a python app in a separate
process from another Python app?
Ed! Good to see you on c.l.py!

a) Try using the subprocess module
b) Use *.pyw programs to ensure no console window is created.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Nov 9 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.