AttributeError into a bloc try-except AttributeError

Vincent Vande Vyvre vincent.vande.vyvre at
Sun Jun 12 03:20:44 EDT 2016


I have a strange behaviour in my code.

In an interactive session, the result is as expected:

Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
 >>> a = None
 >>> try:
...     _ = a.value
... except AttributeError:
...     print('OK')

But not in my code:

     def call_settings_dialog(self):
             _ =
         except AttributeError:

and ...

Traceback (most recent call last):
   File "/home/vincent/qarte-3/trunk/", line 240, in 
     _  =
AttributeError: 'TVItem' object has no attribute 'category'

I have two types of video, one with an attribute category handled by a 
module 'artelive' and an other without this attribute handled by an 
other module, that's the reason of this code.

More information about the Python-list mailing list