如果捕获到异常,是否可以阻止初始化 python 对象__init__
?
例子
class pwm():
def __init__(self):
try:
wiring_pi = cdll.LoadLibrary('/home/lib.so')
except:
print "Problem with loading the library:", sys.exc_info()
#DON'T CREATE THE OBJECT, FOR IT IS USELES WITHOUT lib.so