【发布时间】:2018-06-19 14:49:53
【问题描述】:
我收到值为 128 的“未知错误”。这是我尝试过的事情,但我无法进入异常块。
也在我得到的控制台中:
错误:找不到进程“NULL.exe”。
try:
tmp = os.system("c:/windows/system32/taskkill /f /im NULL.exe")
except OSError as e:
print("We made it into the excepetion!!" + str(e))
try:
tmp = os.system("c:/windows/system32/taskkill /f /im NULL.exe")
except OSError:
print("We made it into the excepetion!!")
try:
tmp = os.system("c:/windows/system32/taskkill /f /im NULL.exe")
except os.error:
print("We made it into the excepetion!!")
try:
tmp = os.system("c:/windows/system32/taskkill /f /im NULL.exe")
except ValueError:
print("We made it into the excepetion!!")
try:
tmp = os.system("c:/windows/system32/taskkill /f /im NULL.exe")
except:
print("We made it into the excepetion!!")
【问题讨论】:
-
当 tmp 不为 0 时,您可能需要引发 oserror 异常
-
是的,我可以试试这个,但这会结束我的功能或进程吗??
标签: python try-catch os.system except taskkill