From 597628f43adc63aeccdd70f77c809eb96f0772b9 Mon Sep 17 00:00:00 2001 From: Vincent Fazio Date: Fri, 24 Aug 2018 12:03:54 +1000 Subject: [PATCH] Prevent 'AttributeError' when printing object attributes --- port/PyAssimp/pyassimp/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index 8950e54aa..64d6d69c6 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -124,8 +124,8 @@ def _init(self, target = None, parent = None): except: uni = str(obj.data, errors='ignore') 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 name = m[1:].lower()