简体   繁体   English

Spyder 跟踪调试 - Python

[英]Spyder Trace Debugging - Python

I am having a weird situation where the trace for an AttributeError keeps referencing the exact same absolute line number in my code.我遇到了一种奇怪的情况,即 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'

If I make line 148 empty (by putting in new lines, etc.) or if I put a comment on line 148, the trace keeps pointing to line 148 as the source of the error.如果我将第 148 行设为空(通过添加新行等),或者如果我在第 148 行添加注释,则跟踪会一直指向第 148 行作为错误的来源。

I am having trouble debugging this particular error in general since I am (to the best of my knowledge) not using that particular attribute on any list object in my code (but it seems to indicate that I'm doing so).一般来说,我在调试这个特定错误时遇到了麻烦,因为我(据我所知)没有在我的代码中的任何列表 object 上使用该特定属性(但它似乎表明我正在这样做)。 I will figure out that issue on my own.我会自己解决这个问题。 My main question is: what causes Spyder to repeatedly reference the exact same absolute line number in a traceback?我的主要问题是:是什么导致 Spyder 在回溯中重复引用完全相同的绝对行号? Thank you.谢谢你。

When in doubt, use a fresh new console - that worked for me.如有疑问,请使用对我有用的全新控制台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM