port/PyAssimp/pyassimp/core.py & helper.py: catch specific exceptions instead of BaseException

pull/2392/head
Charlie Gettys 2019-03-27 13:18:01 -04:00
parent 0292acd5a9
commit e849b94f68
2 changed files with 282 additions and 282 deletions

View File

@ -15,7 +15,7 @@ if sys.version_info >= (3,0):
try: import numpy try: import numpy
except: numpy = None except ImportError: numpy = None
import logging import logging
import ctypes import ctypes
logger = logging.getLogger("pyassimp") logger = logging.getLogger("pyassimp")
@ -67,7 +67,7 @@ def make_tuple(ai_obj, type = None):
def _convert_assimp_string(assimp_string): def _convert_assimp_string(assimp_string):
try: try:
return unicode(assimp_string.data, errors='ignore') return unicode(assimp_string.data, errors='ignore')
except: except UnicodeError:
return str(assimp_string.data, errors='ignore') return str(assimp_string.data, errors='ignore')
# It is faster and more correct to have an init function for each assimp class # It is faster and more correct to have an init function for each assimp class

View File

@ -14,7 +14,7 @@ import re
import sys import sys
try: import numpy try: import numpy
except: numpy = None except ImportError: numpy = None
import logging;logger = logging.getLogger("pyassimp") import logging;logger = logging.getLogger("pyassimp")
@ -276,5 +276,5 @@ def hasattr_silent(object, name):
try: try:
return hasattr(object, name) return hasattr(object, name)
except: except AttributeError:
return False return False