【发布时间】:2020-08-22 03:19:02
【问题描述】:
我遇到了一种奇怪的情况,即 AttributeError 的跟踪一直在我的代码中引用完全相同的绝对行号。
Traceback (most recent call last):
File "<ipython-input-59-513669e63f3e>", line 4, in <module>
"line of code being run"
File "modulepath", line 148, in "method that contains the line of code"
"content of the line causing the error"
AttributeError: 'list' object has no attribute 'attribute_name'
如果我将第 148 行设为空(通过添加新行等),或者如果我在第 148 行添加注释,则跟踪会一直指向第 148 行作为错误源。
一般来说,我在调试这个特定错误时遇到了麻烦,因为我(据我所知)没有在我的代码中的任何列表对象上使用该特定属性(但它似乎表明我正在这样做)。我会自己解决这个问题。我的主要问题是:是什么导致 Spyder 在回溯中重复引用完全相同的绝对行号?谢谢。
【问题讨论】:
标签: python debugging runtime-error spyder traceback