在下面的python中,消息RSU在單節點機器上不受支持**未被打印。任何人都可以幫忙嗎?python異常處理
#! /usr/bin/env python
import sys
class SWMException(Exception):
def __init__(self, arg):
print "inside exception"
Exception.__init__(self, arg)
class RSUNotSupported(SWMException):
def __init__(self):
SWMException.__init__(self, "**RSU is not supported on single node machine**")
def isPrepActionNeeded():
if 1==1:
raise RSUNotSupported()
try:
isPrepActionNeeded()
except:
sys.exit(1)
異常.__ init __(self,arg) 這個init調用中的arg參數是什麼?它不打印消息 – mandeep
它是使消息成爲異常的一部分,所以如果你願意,你可以在以後自己打印。 – agf
好的,是的。非常感謝。這真的很有幫助 – mandeep