Yep, It is an X problem.  Does the following work?
  if os.fork():
        import gtk
        print "parent"
  else:
        import gtk
        print "child"

That way two X connections are established -- one for each process.  If
you only need to use GTK for one process, only import it there.

James Henstridge.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


On Mon, 30 Nov 1998, Martin Preishuber wrote:

> Re,
> 
> > Surely you must be able to fork in a GTK program, since this is used in
> > the GNOME libraries for things like scores, program loading and other
> > things (the best example being the panel, where fork'ing and exec'ing are
> > its main job.
> 
> ok, fine
> 
> > Do you know which process is dieing?  Also, what happens if you run your
> > script like this:
> > 
> >   $ gdb python
> >   (gdb copyright message)
> >   gdb> run scriptname.py
> > 
> > Which of the two processes dies?  If the main process dies, could you try
> > doing a backtrace (with the bt command under gdb), and see if it gives any
> > clues.
> 
> I've attached the test script I'm using (fork.py):
> 
> - The script works without the "import gtk" line
> - Including the "import gtk" line I get the following error:
> 
> Gdk-Message: locale not supported by C library
> parentpid: 4348
> childpid: 4349
> Gdk-Message: 
> ** ERROR **: sigpipe caught
> 
> - Running it through gdb:
> 
> (gdb) run fork.py
> Starting program: /usr/local/bin/python fork.py
> Gdk-Message: locale not supported by C library
> childpid: 4354
> parentpid: 4351
> 
> Program received signal SIGPIPE, Broken pipe.
> 0x40096744 in __write ()
> (gdb) info program
>         Using the running image of child Pid 4351.
> Program stopped at 0x40096744.
> It stopped with signal SIGPIPE, Broken pipe.
> (gdb) bt
> #0  0x40096744 in __write ()
> #1  0x402f8c84 in __DTOR_END__ ()
> #2  0x402aace9 in _X11TransWrite ()
> #3  0x40291cd8 in _XFlushInt ()
> #4  0x40292fe2 in _XReply ()
> #5  0x4028f129 in XSync ()
> #6  0x40278bd9 in XCloseDisplay ()
> #7  0x4021c586 in gdk_exit_func () at gdk.c:3048
> #8  0x4004a6f5 in exit (status=0) at exit.c:55
> 
> Hope this helps somehow ...
> 
> Martin
> 
> -- 
> Martin Preishuber - Student, ECLiPt Member, SysAdmin
> http://eclipt.uni-klu.ac.at,
> mailto:[EMAIL PROTECTED]
> 
> The difference between legal separation and divorce is that legal
> separation gives the man time to hide his money.

To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to