Menu ▾ ▴

Lots of unresolved imports

Doug Cook
2009-01-13
2013-03-15
  • Doug Cook

    Doug Cook - 2009-01-13

    Hi, I'm having problems with the Code Analysis feature of PyDev extensions. I've tried this on both 1.4.1 and 1.4.2; the system is a Mac running MacOS X 10.5.6 / Python 2.5.

    I'm getting lots of "unresolved import" complaints about common modules (random, md5, etc). These are in my system PYTHONPATH; for example, I have /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5 in in the PYTHONPATH, and I see /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/md5.{pyc,pyo}. 

    I've removed and re-specified the interpreter/PYTHONPATH to clear anything PyDev might have been caching, to no avail.

    I'm a bit of a newbie to both Python and PyDev (but have lots of software experience with other languages and with Eclipse in general). Any suggestions on what might be the problem?

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-01-13

      Let's take only one for example...

      "import md5" is giving you an unresolved import error right? Do you have an md5.py file in your pythonpath? (or only .pyc/.pyo?)

      Cheers,

      Fabio

       
    • Doug Cook

      Doug Cook - 2009-01-13

      Hi Fabio,

      Thanks for the quick response.

      I think one example is just fine, since as far as I can tell all the errors have exactly the same symptoms.

      Just the .pyc/.pyo as far as I can tell. This is the default MacOS Python install (2.5.1).

      Outside Eclipse the package builds & runs just fine with the system PYTHONPATH + the project-specific one. I've verified that the paths are identical within Eclipse and outside it.

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2009-01-13

        That should be the reason: Pydev needs the source files for completion/analysis to work (otherwise you have to add all those modules to the forced builtins).

        Instead of using the default python install, try getting an install that has the source files.

        Cheers,

        Fabio

         
    • Doug Cook

      Doug Cook - 2009-01-13

      Thanks! I'll give that a whirl. The quick response is much appreciated.

      doug

       
    • Doug Cook

      Doug Cook - 2009-01-14

      Just to follow up: that did the trick. For any other Mac developers that have the same problem, installing Xcode is a quick fix; it's got the .py sources included.

      Thanks again for the quick response, saved me a lot of time.