作者:宅_OTKAU_370 | 来源:互联网 | 2022-12-04 16:25
我使用Python扩展已经使用Visual Studio代码了很长时间.
目前我有Visual Studio代码版本1.27.2,Python扩展名"ms-python.python"版本2018.8.0,python版本3.6.6,由Windows 10 1803企业版系统托管.
与过去相比,最新版本的Code/MS Python在调试过程中表现不同.
过去,在Visual Studio Code中执行以下Python代码不会产生任何异常:
# Import exit from sys
from sys import exit as sys_exit
# Exit to system with errorlevel set to 1
sys_exit(1)
# Next instruction is never executed.
# Executing the script directly from the terminal in Windows sets the
# errorlevel to 1 and the script execution is terminated.
print('unreachable code')
现在,当执行sys_exit(1)指令时,结果是一个SystemExit异常(VSCode屏幕截图).
问题:有没有办法禁用此行为并返回上一个行为?
1> Joshua L. Ro..:
在调试Flask应用程序时遇到了类似的情况。我的解决方法是在调试窗口底部的断点菜单中取消选中“未捕获的异常”。