Unresolved import error in PyDev

Fredrik Bonander's Avatar

Fredrik Bonander

28 May, 2010 11:52 AM

Hi,

I'm having some problems with random "unresolved import" errors. On one machine it can't import google app engine's modules on the other it can't import logging, md5 etc.

It's a bit annoying since code completion stops working for what ever it can't import. Just to make it a bit wired, code completion work for finding the modules. ie. I start writing "from goog..." and the code completion pops up.

Is there any way/setting/config to fix this? Or and clue where to look for what fails with the import?

..fredrik

  1. 2 Posted by Joe Saland on 25 Jun, 2010 11:50 AM

    Joe Saland's Avatar

    Having the exact same issue except it's even happening with modules in the same app different directories.

    I'll have something like

    from blahblah import blah
    from blahblah import alsoblah

    both blah and alsoblah are in the right location and for some reason randomly one or both of them will suddenly go from working to not working. So it's not like my PATH is wrong (if it was really unresolved the app wouldn't run which it does).

    Again once I get the failure a lot of related things can start to go wrong with code completion, recognition of other syntax errors being missed, etc.

    Joe

  2. 3 Posted by Wayne on 04 Aug, 2010 01:36 AM

    Wayne's Avatar

    I can't figure this out either... annoying!

  3. 4 Posted by Nick Farina on 16 Aug, 2010 06:13 PM

    Nick Farina's Avatar

    I was having this issue as well, and fixed it by forcing PyDev to update its indexing database (presumably). Just go into Project Properties, then Interpreter, then "Configure an Interpreter not listed" hyperlink, then make some nondestructive edits to a python path therein, it'll make PyDev think it needs to reindex everything and this usually fixes this sort of issue for me.

    After doing this, make sure to make another random edit in each file displaying the error markers ("unresolved import", etc.) to force PyDev to rescan those as well.

  4. 5 Posted by Nick Farina on 16 Aug, 2010 06:15 PM

    Nick Farina's Avatar

    Also: PyDev is awesome. That is all.

  5. Support Staff 6 Posted by Fabio Zadrozny on 31 Aug, 2010 08:28 PM

    Fabio Zadrozny's Avatar

    There are instructions on how to properly setup the configuration at: http://pydev.org/manual_101_root.html (under configuring interpreter and creating/configuring project).

    Note that whenever you add a new module to the interpreter you're advised to go to the interpreter preferences and remove and add the interpreter again so that the interpreter its re-indexed (note that if no paths changed, just go there and press 'apply' and it'll re-index things for the interpreters you want).

    Now, If the indexing gets lost inside a project, you can go to the project properties > pydev - pythonpath and click 'force restore internal info'. This will force the reindexing of the project.

    Still, note that the interpreter update is that way by 'design', but if the project gets out of sync, that'd indicate a bug, so, if someone can reproduce that, it'd be nice reporting a bug on how that happens.

  6. Fabio Zadrozny closed this discussion on 31 Aug, 2010 08:28 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac