How did you start the other application? If you are using os.system()
then what you are seing is the correct behaviour -- the parent process
suspends until the child dies. If you don't want this behaviour, you will
need to do the fork/exec yourself.
Something like this:
pid = os.fork()
if pid < 0:
print "Some error occured during the fork"
sys.exit(1)
else if pid == 0:
# child
os.exec(...) # whatever the arguments are supposed to be
# anything after this point is only executed if os.exec fails
os._exit(1) # not sys.exit()
# parent process continues execution here
You will also have to do something about reaping the child process when it
dies. This is done by setting up a SIGCHLD handler (using the signal
module (which has nothing to do with GTK signal handling). If you care
about the return value of the child process, the signal handler should be
a function that calls os.wait(). If you don't care about the return
value, use signal.SIG_IGN as the signal handler.
The reason for using os._exit() rather than sys.exit() in the child is
that after the fork, the parent and child are sharing file descriptors.
If the child exits, then it will tell the X server that it is finished
with its connection, breaking the connection for the parent as well. This
is avoided by calling os._exit().
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
On Thu, 10 Feb 2000 [EMAIL PROTECTED] wrote:
> Hello,
>
> I would like to launch another application (named B) when I click on a
> button. I coded this, but since B is not closed, my python-gtk
> application is freezed. Did I missed something ?
>
> Thanks.
> --
> ..
> .^. | Didier Bretin, France | [EMAIL PROTECTED]|
> /V\ |---| www.informactis.com|
>// \\| `|
> /( )\ | Visit: http://www.multimania.com/cieexcalibur/ |
>^^-^^`'
>
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
>
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]