From 1614b7bea42ceeceaba212388560693726212355 Mon Sep 17 00:00:00 2001 From: Charlie Gettys Date: Wed, 27 Mar 2019 13:25:07 -0400 Subject: [PATCH] port/PyAssimp/pyassimp/core.py: convert_assimp_string now switches on version instead of just catching the exception if unicode is not defined & _init_face uses is None instead of == None --- port/PyAssimp/pyassimp/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index 974a7d61a..c781f27c9 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -65,10 +65,10 @@ def make_tuple(ai_obj, type = None): # Returns unicode object for Python 2, and str object for Python 3. def _convert_assimp_string(assimp_string): - try: - return unicode(assimp_string.data, errors='ignore') - except UnicodeError: + if sys.version_info >= (3, 0): return str(assimp_string.data, errors='ignore') + else: + return unicode(assimp_string.data, errors='ignore') # It is faster and more correct to have an init function for each assimp class def _init_face(aiFace): @@ -303,7 +303,7 @@ def load(filename, # unsigned int pLength, # unsigned int pFlags, # const char* pHint) - if file_type == None: + if file_type is None: raise AssimpError('File type must be specified when passing file objects!') data = filename.read() model = _assimp_lib.load_mem(data,