Hi,

 I just realized that I cannot try/except an error raised in a
 get_property. in the following example, "get_date" will raise an error but
 the try/except loop won't catch it.
 
 Any idea why and what I can do to have an error that is catched by
 by try/except statement?

 TIA
 sandro
 *:-)


import gobject

class MyError(Exception): pass

class Test(gobject.GObject):
    __gproperties__ = {
        'date' : (gobject.TYPE_PYOBJECT,                       # type
                    'Date',                                    # nick name
                    'The date currently selected',             # description
                    gobject.PARAM_READWRITE),                  # flags
        }

    def get_date(self):
        raise MyError("Gulp!")

    def do_get_property(self, property): 
        if property.name == 'date':
            return self.get_date()


    
t = Test()
try:
    t.get_property('date')  # this will raise MyError
except:                     # this will not catch it!!!!
    pass




-- 
Sandro Dentella  *:-)
http://sqlkit.argolinux.org        SQLkit home page - PyGTK/python/sqlalchemy
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to