Prevent 'AttributeError' when printing object attributes

pull/2103/head
Vincent Fazio 2018-08-24 12:03:54 +10:00
parent 8ceca4daaf
commit 597628f43a
1 changed files with 2 additions and 2 deletions

View File

@ -124,8 +124,8 @@ def _init(self, target = None, parent = None):
except: except:
uni = str(obj.data, errors='ignore') uni = str(obj.data, errors='ignore')
target.name = str( uni ) target.name = str( uni )
target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + x.name + ")" target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + getattr(x, 'name','') + ")"
target.__class__.__str__ = lambda x: x.name target.__class__.__str__ = lambda x: getattr(x, 'name', '')
continue continue
name = m[1:].lower() name = m[1:].lower()