Starting application inside an application 
Author Message
 Starting application inside an application

Hello!

Platform: Linux

What is the easiest way to launch a new application from e.g. a menu in
a running application?
Using os.system() does not work because the calling application has to
wait until the launched application has terminated.

What I want to do is simply starting a second instance of my application
(just like starting the application from the command line a second
time). I am looking for a function like spawnv() which unfortunately
only works for the windows platform.

Thank you
Horst



Mon, 30 Jun 2003 17:04:34 GMT  
 Starting application inside an application

Horst,

Quote:
> What I want to do is simply starting a second instance of my application
> (just like starting the application from the command line a second
> time). I am looking for a function like spawnv() which unfortunately
> only works for the windows platform.

        Use os.spawnv works great on FreeBSD and python 2.0 built fresh
from the ports tree. It isn't in 1.x but it is in 2.0. I am assuming your
using 1.x since you say it's only a windows "feature". Just upgrade to
2.0. The call works like a charm :-)

#!/usr/local/bin/python

import os
host = raw_input("Enter a hostname: ");

--
=============================================================================
-Chris Watson         (316) 326-3862 | FreeBSD Consultant, FreeBSD Geek


=============================================================================
WINDOWS: "Where do you want to go today?"
LINUX: "Where do you want to go tomorrow?"
BSD: "Are you guys coming or what?"
=============================================================================
irc.openprojects.net #FreeBSD -Join the revolution!
ICQ: 20016186



Tue, 01 Jul 2003 01:00:36 GMT  
 Starting application inside an application

Quote:

> Hello!

> Platform: Linux

> What is the easiest way to launch a new application from e.g. a menu in a
> running application? Using os.system() does not work because the calling
> application has to wait until the launched application has terminated.

> What I want to do is simply starting a second instance of my application
> (just like starting the application from the command line a second
> time). I am looking for a function like spawnv() which unfortunately only
> works for the windows platform.

> Thank you Horst

You can popen() a process. You pass the command line
to popen() and it returns a file object which you
can then use as normal.  

Or, you can do what popen() is really doing, only
do it yourself.  Popen just forks a process, and
exec's a shell to execute your command line.

--
David Allen
http://opop.nols.com/
----------------------------------------
"The number of UNIX installations has grown to 10, with more expected."
-- The UNIX Programmer's Manual, 2nd Edition, June, 1972



Tue, 01 Jul 2003 03:52:12 GMT  
 Starting application inside an application

| Platform: Linux
|
| What is the easiest way to launch a new application from e.g. a menu in
| a running application?
| Using os.system() does not work because the calling application has to
| wait until the launched application has terminated.
|
| What I want to do is simply starting a second instance of my application
| (just like starting the application from the command line a second
| time). I am looking for a function like spawnv() which unfortunately
| only works for the windows platform.

On the contrary, I bet os.spawnv() will work fine for you.

   >>> import os
   >>> os.spawnv(os.P_NOWAIT, '/usr/bin/uname', ('uname', '-s'))
   1445
   >>> FreeBSD

   >>>

Check it out.




Tue, 01 Jul 2003 04:40:40 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Embedding an X application inside another application

2. Q: How do I start an application from within a realbasic application

3. Labview Application Builder, Application uninstaller remove the complete Start Menu Program group

4. T-gen inside an application?

5. Forth inside Windows applications?

6. embedding ruby inside an application?

7. Execute an external application from inside a python script

8. Calling an application from inside a python script Take 1

9. run a python application inside the python shell

10. Q: run a python application inside the python shell

11. Setting an environment inside an application Tcl interpreter

12. How to handle path inside a wrapped application

 

 
Powered by phpBB® Forum Software