python bindings & gmainloop

John (J5) Palmieri johnp at redhat.com
Fri Sep 16 08:28:33 PDT 2005


On Thu, 2005-09-15 at 15:01 -0700, Sean Meiners wrote:

> Ok, so I finally figured out how to get gmainloop to play nice with other 
> threads, only to expose an even more interesting problem.  When my test 
> script is run (attached) it causes a 'Fatal Python error: PyThreadState_Get: 
> no current thread' as soon as the gmainloop is entered, but only if threading 
> has been initialized and you actually connect to a bus (system or session, it 
> makes no difference). Now here's the really interesting part: it all works 
> fine if I undo your EmptyMessage patch (diff attached).

I'll take a look.  It might just be your connection going out of scope
and you not holding a reference to it somewhere.
> 
> >
> > Another point is I recently split out the GLib stuff so anyone is free
> > to implement another main loop adapter.  Look at the dbus.py and
> > dbus_glib_bindings.pyx files to see how this is done.  Patches are
> > welcome.
> 
> I poked around in there, but it calls dbus_connection_setup_with_g_main which 
> does all the heavy lifting of gmainloop integration which in turn relies on 
> several dbus_connection_set_* functions that aren't exported by the python 
> bindings as far as I can tell. So there doesn't seem to be a way to replace 
> the gmainloop in the python bindings without direct modification. I was 
> hoping to be able to do the gmainloop replacement in my application and leave 
> the bindings to you ;) .

The Qt bindings should have something similar to
dbus_connection_setup_with_g_main.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list