使Python3异常向后兼容
此代码块(从)的向后(如果可能,为2.6)兼容语法是什么:使Python3异常向后兼容,python,python-3.x,syntax,compatibility,python-2.x,Python,Python 3.x,Syntax,Compatibility,Python 2.x,此代码块(从)的向后(如果可能,为2.6)兼容语法是什么: 这与python-2.x中的内容非常接近: try: self.spawn(pp_args) except DistutilsExecError as msg: print "DistutilsExecError : " + str(DistutilsExecError(msg)) print print "The above exception was the direct cause of the fo
这与python-2.x中的内容非常接近:
try:
self.spawn(pp_args)
except DistutilsExecError as msg:
print "DistutilsExecError : " + str(DistutilsExecError(msg))
print
print "The above exception was the direct cause of the following exception:"
raise CompileError
try:
self.spawn(pp_args)
except DistutilsExecError as msg:
print "DistutilsExecError : " + str(DistutilsExecError(msg))
print
print "The above exception was the direct cause of the following exception:"
raise CompileError