PyDev:导入中未定义的变量:__name__
我经常在代码中使用类的 __name__
属性(在 Python 中完美运行),但 PyDev 始终将其标记为错误(Undefined variable from import< /强>)。
我尝试将 __name__ 添加到公告导入中,但这并没有消除问题。
当我使用自动完成功能时,PyDev 在类后面键入 .
时发现 __class__
属性是错误的。但如果我无论如何使用 __class__ 属性,PyDev 会找到 __name__ 属性。
PyDev 中是否存在与将类与实例对象混合有关的错误? 有什么解决方法吗?
感谢您的任何帮助。
I use regularly the __name__
property of classes in my code (which works perfectly in Python) but PyDev is always marking it as an error (Undefined variable from import).
I tried to add the __name__
to the bulletin imports but this did not remove the problem.
When I use auto completion, PyDev finds a __class__
property when typing a .
behind a class which is wrong. But if I use __class__
property anyway, PyDev finds the __name__
property.
Is there any bug in PyDev that has to do with mixing up classes with instanced objects?
Is there any workaround?
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 PyDev 中的一个错误。请在 PyDev sf 跟踪器中报告这一点。请参阅:http://pydev.org/about.html 获取链接。
It's a bug in PyDev. Please report that in the PyDev sf tracker. See: http://pydev.org/about.html for links.
我刚刚遇到这个问题。在阅读了一些表格后,看起来这是控制台或内核加载速度不够快的问题......
我只是关闭了文档并重新打开它,所有错误都消失了。
I just ran into this problem. After reading some forms on it, it looks like it's a problem with the console or kernel not loading fast-enough...
I just closed the document and re-opened it and all the errors went away.