【问题标题】:pdb skipped one hidden frame issuepdb 跳过了一个隐藏帧问题
【发布时间】:2020-07-23 09:17:46
【问题描述】:

每当我尝试在 ipython 单元格中运行程序时,它都会给我一个奇怪的错误。

test_pts = sorted_points
new_segments = []
import pdb; pdb.set_trace()
for i in range(0, len(test_pts)-1):
    x1 = test_pts[i][0]; y1 = test_pts[i][1]; x2 = test_pts[i][2]; y2 = test_pts[i][3]; angle1 = test_pts[i][4]
    print(x1, y1, x2, y2, angle1)
    for j in range(i + 1, len(test_pts)):
        n_x1 = test_pts[j][0]; n_y1 = test_pts[j][1]; n_x2 = test_pts[j][2]; n_y2 = test_pts[j][3]; angle2 = test_pts[j][4]
        if (isclose(angle1, angle2, rel_tol = 1)) and (isclose(x1, x2, rel_tol = 1) and (isclose(y1, y1, rel_tol = 1))):
            
            print(n_x1, n_y1, n_x2, n_y2, angle2) 
            break  

下面的堆栈跟踪 -> 我觉得这个问题不可重现,甚至不是特定于代码的,即我编写的​​代码没有任何问题,但我无法弄清楚是什么原因造成的这种行为。

# %% LINE EXTENSION - CONNECT...
--Return--
None
> (3)()
      1 test_pts = sorted_points
      2 new_segments = []
----> 3 import pdb; pdb.set_trace()
      4 for i in range(0, len(test_pts)-1):
      5     x1 = test_pts[i][0]; y1 = test_pts[i][1]; x2 = test_pts[i][2]; y2 = test_pts[i][3]; angle1 = test_pts[i][4]

    [... skipped 1 hidden frame]

> /home/and/CERLAB/lib/python3.8/site-packages/IPython/core/interactiveshell.py(3346)run_code()
   3344             finally:
   3345                 # Reset our crash handler in place
-> 3346                 sys.excepthook = old_excepthook
   3347         except SystemExit as e:
   3348             if result is not None:

【问题讨论】:

    标签: python ipython pdb


    【解决方案1】:

    我仍然不确定到底是什么问题 - 这不是在普通 python 文件中发生的事情,似乎只发生在 .ipnyb 文件中。

    以这种方式放置的断点只有在函数内部时才有效,否则无效。所以基本上如果你遇到这个问题,那么请确保语句在函数内部。

    【讨论】:

      猜你喜欢
      • 2022-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-21
      • 1970-01-01
      • 2019-06-11
      • 1970-01-01
      相关资源
      最近更新 更多