Browse Source

Prevent 'AttributeError' when printing object attributes

Vincent Fazio 7 years ago
parent
commit
597628f43a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      port/PyAssimp/pyassimp/core.py

+ 2 - 2
port/PyAssimp/pyassimp/core.py

@@ -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__.__str__ = lambda x: x.name
+            target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + getattr(x, 'name','') + ")"
+            target.__class__.__str__ = lambda x: getattr(x, 'name', '')
             continue
             continue
 
 
         name = m[1:].lower()
         name = m[1:].lower()