Unresolved import: poplib

cerberos
2011-02-19
2013-03-15
  • cerberos
    cerberos
    2011-02-19

    When I import poplib I get an unresolved import error, this module is part of the standard library.

    I added it manually to forced builtins and the error goes but I don't get any completions.

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-02-22

    It seems to work for me without adding it to the forced builtins… Can you just check if the folder that has the poplib.py is actually in the pythonpath in the interpreter? Also, do you have any errors in your error log? Are you using a virtualenv?

    Cheers,

    Fabio

     
  • cerberos
    cerberos
    2011-03-02

    There is no poplib.py as poplib is part of the standard library. When I switched to a different interpreter (virtualenv) the problem went away.

     
  • cerberos
    cerberos
    2011-03-02

    When I use my system's native python interpreter (2.7) everything is fine, however when I use a virtualenv interpreter (both with and without site packages) I get unresolved imports for modules which are in the standard library (eg poplib, random). I can import sys and os successfully with a ve interpreter so am wondering what the differences between these modules are.

    I've tried this with both Aptana 3 Beta and a clean eclipse classic install with pydev from the update url (not nightly build), both have the same problem. I've checked the log files and can't find anything of note.

    I'd really like to solve this and would be interested if anyone else has similar issues when using ve interpreters (or confirmation that others are using ve interpreters without issue).

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-03-03

    The issue is probably that you didn't add the path from the original interpreter when you added the virtualenv interpreter (those paths are not checked by default). So, remove the interpreter and add it again checking those paths.

    Cheers,

    Fabio

     
  • cerberos
    cerberos
    2011-03-03

    But when you create a virtualenv you specifically don't want the original paths, otherwise it wouldn't be a virtualenv right?

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-03-03

    Actually, no, when you create a virtualenv it's based on an existing interpreter, so, whatever you add to that base interpreter will be added to the virtualenv interpreter, the good thing is that what you add to the virtualenv will not be added to the base one.

    So, the idea is to have a base with the common libraries for everything you want and multiple virtualenv with specific dependencies.

    Cheers,

    Fabio

     
  • cerberos
    cerberos
    2011-03-04

    I did what you said and it worked, but I'm still not convinced by your explanation, I don't doubt you - I just don't understand  :) afaik with -no-site-packages you get just the interpreter and a few other supporting bits (the python binary is copied to the new location to create the environment and you get a new, empty site-packages folder.

    Anyway, thanks for your help (and work, I love pydev)

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2011-03-08

    The problem isn't really the /site-packages folder, but the /Lib folder.

    Cheers,

    Fabio