问题
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.
回答1:
It's a bug in PyDev. Please report that in the PyDev sf tracker. See: http://pydev.org/about.html for links.
回答2:
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.
来源:https://stackoverflow.com/questions/5831854/pydev-undefined-variable-from-import-name