Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyDev bugs with imports

I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !)

The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine.

Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ...

I just can't understand what is happenning ?

So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working.

Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ?

Thank you.

References :

  • python 2.4.4 (built from sources)
  • PyDev v 1.6.0 2010071813
like image 955
ThR37 Avatar asked Oct 05 '10 11:10

ThR37


People also ask

What is a PyDev package?

A "PyDev Package" is a Python package. This means that it contains a file called __init__.py . For example, if you create a new PyDev Package with name foo , then you will get file foo/__init__.py . You can place other .py files into foo/ , which you can then import.

What is PyDev used for?

PyDev is a third-party plug-in for Eclipse. It is an Integrated Development Environment (IDE) used for programming in Python supporting code refactoring, graphical debugging, code analysis among other features.

How do I get out of PyDev Eclipse?

pydev* from eclipse/plugins and eclipse/features or you can go to help > software updates > manage configuration, choose the PyDev plugin and disable it (after that, to completely remove it, you must restart Eclipse and only then select it for uninstall).


1 Answers

This can happen if new modules are not cached by PyDev. For example, on my new laptop I first set up PyDev/Eclipse and later installed the Django package. That's why Django imports were marked as unresolved. You can refresh it using Pydev > Interpreter - Python > Libraries > Apply. Select the interpreter you want to "restore" (they could have chosen a better word) and click OK. PyDev will then reparse all installed modules.

I'm using the nightly version of PyDev, but any 1.6.x version should work correctly. If that doesn't help, remove the interpreter configure and create a new one.

like image 138
AndiDog Avatar answered Oct 11 '22 19:10

AndiDog