&quot'当出现错误时直接输入调试。当我在单元格上运行它时,Spyder中的消息无效
我对Spyder中的调试模式有疑问: 在 下,工具 - >偏好 - >运行 我检查了“出现错误时直接输入调试”。当我运行整个脚本时,这很好。例如:
def divide_by(a):
c=a-2
return 3/c
divide_by(2)
由于零除法,Spyder引发了错误并跳到调试模式
****************************************
Entering post mortem debugging...
****************************************
> /home/test.py(3)divide_by()
1 def divide_by(a):
2 c=a-2
----> 3 return 3/c
4
5
IPdb[1]:
,但是我将脚本分开为单元格(使用#%%) 例如:
def divide_by(a):
c=a-2
return 3/c
#%%
divide_by(2)
当我仅执行最后一个单元格时(仅表示此行:divide_by(2)
通过按“运行当前单元格”按钮)时,Spyder会丢弃错误,因为该划分为零,但是它不会跳到调试模式。
是否有可能“直接在出现错误时直接输入调试” - Spyder中的功能在仅一个单元格而不是执行整个脚本时也起作用?
非常感谢您的建议!
I have a question regarding the debugging mode in Spyder:
Under Tools -> preferences -> Run I checked "Directly enter debugging when error appears". This works pretty well when I run the whole script. For example:
def divide_by(a):
c=a-2
return 3/c
divide_by(2)
Because of division by zero, Spyder throws an error and jumps to debugging mode
****************************************
Entering post mortem debugging...
****************************************
> /home/test.py(3)divide_by()
1 def divide_by(a):
2 c=a-2
----> 3 return 3/c
4
5
IPdb[1]:
However, I separated my script into cells (using #%%)
For example:
def divide_by(a):
c=a-2
return 3/c
#%%
divide_by(2)
When I only execute the last cell (means only this line: divide_by(2)
by pressing the "run current cell" button), Spyder is throwing an error because of the division by zero, but it doesn't jump to debugging mode.
Is there any possibility that the "Directly enter debugging when error appears"- functionality in Spyder also works when only a cell and not the whole script is executed?
Many thanks for any suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论