Ipython magic事后调试行不是以前的lin

2024-04-19 10:47:59 发布

您现在位置:Python中文网/ 问答频道 /正文

是否可以使用Ipython magic %debug来调试不是前一行的行

问题是:我有一个习惯,用手指粗敲输入

In [1]: %run myscript.py
ValueError: blah blah blah. # <---- the error I care about

In [2]: $debug  # or %devug or some other stupid mistake
SyntaxError: invalid syntax

In [3]: %debug  # <--- now this wants to debug my stupid typo

有没有办法指定调试中的前一行?比如:

%debug In[1]

Tags: ortheruninpydebugmagicipython