I have written a python script to use gstreamer (pygst and gst modules) to calculate replaygain tags, and it was crashing inconsistently with various gobject errors. I found somewhere that you could fix this by putting the following boilerplate at the top of your script:
import gobject
gobject.threads_init()
I tried it, and it worked. Can anyone explain why these lines are necessary, and why pygst doesn't do this itself?