[pygtk] gobject, property and Exception
Alessandro Dentella
sandro at e-den.it
Fri Mar 13 20:33:34 WST 2009
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
More information about the pygtk
mailing list