port/PyAssimp/pyassimp/core.py & helper.py: catch specific exceptions instead of BaseException
parent
0292acd5a9
commit
e849b94f68
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue