May I repost this as I guess this is something I'm really missing and I
think pygtk *is* the list where I have more chance to meet who can explain
this... 

thanks
sandro

On Fri, Mar 13, 2009 at 12:33:34PM +0100, Alessandro Dentella wrote:
> 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/

-- 
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