# -*- coding: UTF-8 -*- import gtk import gobject buf = gtk.TextBuffer() buf.register_deserialize_tagset() cont = "Här ska det inte visas en bild." try: text = buf.deserialize(buf, "application/x-gtk-text-buffer-rich-text", buf.get_start_iter(), cont) except gobject.GError, e: print "%s has errors: %s" % (cont, e) text = cont print "EOF"