fix: up
This commit is contained in:
parent
088f5c96c2
commit
0e80c66c71
11
main.py
11
main.py
@ -149,7 +149,16 @@ def main():
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\n程序被用户中断")
|
print("\n程序被用户中断")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"发生错误: {e}")
|
import traceback
|
||||||
|
import sys
|
||||||
|
exc_type, exc_value, exc_tb = sys.exc_info()
|
||||||
|
tb = traceback.extract_tb(exc_tb)
|
||||||
|
if tb:
|
||||||
|
last_call = tb[-1]
|
||||||
|
print(f"发生错误: {e}(文件: {last_call.filename}, 行号: {last_call.lineno}, 函数: {last_call.name})")
|
||||||
|
else:
|
||||||
|
print(f"发生错误: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
finally:
|
finally:
|
||||||
print("正在清理资源...")
|
print("正在清理资源...")
|
||||||
Ctrl.quit()
|
Ctrl.quit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user