热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

VisualStudioCodePython调试"SystemExit发生了异常"

如何解决《VisualStudioCodePython调试"SystemExit发生了异常"》经验,为你挑选了1个好方法。

我使用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应用程序时遇到了类似的情况。我的解决方法是在调试窗口底部的断点菜单中取消选中“未捕获的异常”。


推荐阅读
author-avatar
宅_OTKAU_370
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有