Unresolved import error

Anonymous
2010-06-06
2013-03-15

  • Anonymous
    2010-06-06

    I've configured my only python interpreter to be python2.5. I have /usr/lib/python2.5 in my system libs on the interpreter configuration page. Most of my imports work fine but if I do import logging or import traceback, pydev complains they are unresolved. What am I doing wrong and what can I do to remove these errors apart from Ctrl+1 them?

    Thanks for PyDev, overall it is great.

    John.

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2010-06-06

    Are you sure that the folder containing logging.py is in your pythonpath? In windows this is the python/Lib folder (don't have access to linux right now).  If it is, can you check if import base64, works? Also, can you pass the pythonpath you've configured in the interpreter?

    Cheers,

    Fabio

     

  • Anonymous
    2010-06-07

    If I run the following script inside pydev

    import logging
    print logging.__file__
    

    I get this output:

    /usr/lib/python2.5/logging/__init__.pyc
    

    Looking at Windows->Preferences->Pydev->Interpreter Python->Libraries then one of the entries is /usr/lib/python2.5 which should do it, shouldn't it?

    I get the same unresolved problem with "import base64".

    This is PYTHONPATH that gets passed to my scripts when run in Pydev

    /home/john/local/eclipse/plugins/org.python.pydev_1.5.7.2010050621/PySrc/pydev_sitecustomize:/home/john/Dev/MyProjects/Home/Poker/python:/home/john/Dev/MyProjects/Python/Cookbook:/home/john/Dev/eclipse-workspace/PyBrain:/usr/lib/pymodules/python2.5:/usr/lib/pymodules/python2.5/gtk-2.0:/usr/lib/python2.5:/usr/lib/python2.5/lib-dynload:/usr/lib/python2.5/lib-tk:/usr/lib/python2.5/plat-linux2:/usr/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages/CoreBio-0.5.0-py2.5.egg:/usr/lib/python2.5/site-packages/Jinja-1.2-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/Numeric:/usr/lib/python2.5/site-packages/PIL:/usr/lib/python2.5/site-packages/PyBrain-0.3-py2.5.egg:/usr/lib/python2.5/site-packages/PyOpenGL-3.0.0b8-py2.5.egg:/usr/lib/python2.5/site-packages/PyXML-0.8.4-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg:/usr/lib/python2.5/site-packages/Sphinx-0.5.1-py2.5.egg:/usr/lib/python2.5/site-packages/Twisted-8.2.0-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/UPnP_Inspector-0.2.2-py2.5.egg:/usr/lib/python2.5/site-packages/bx_python-0.5.0-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/decorator-3.0.1-py2.5.egg:/usr/lib/python2.5/site-packages/docutils-0.5-py2.5.egg:/usr/lib/python2.5/site-packages/dot2tex-2.8.5-py2.5.egg:/usr/lib/python2.5/site-packages/epydoc-3.0.1-py2.5.egg:/usr/lib/python2.5/site-packages/fpconst-0.7.2-py2.5.egg:/usr/lib/python2.5/site-packages/gst-0.10:/usr/lib/python2.5/site-packages/gtk-2.0:/usr/lib/python2.5/site-packages/ipython-0.10-py2.5.egg:/usr/lib/python2.5/site-packages/pygooglechart-0.2.1-py2.5.egg:/usr/lib/python2.5/site-packages/pyparsing-1.5.2-py2.5.egg:/usr/lib/python2.5/site-packages/rpy2-2.0.8-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/scipy-0.7.1-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/scons-1.2.0-py2.5.egg:/usr/lib/python2.5/site-packages/setuptools-0.6c12dev_r77904-py2.5.egg:/usr/lib/python2.5/site-packages/simplejson-2.0.7-py2.5-linux-x86_64.egg:/usr/lib/python2.5/site-packages/snakefood-1.4-py2.5.egg:/usr/lib/python2.5/site-packages/weblogo-3.0-py2.5.egg:/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode:/usr/local/lib/python2.5/site-packages
    

    Thanks for the quick response,
    John.

     
  • Fabio Zadrozny
    Fabio Zadrozny
    2010-06-07

    Yes, that should work… In /usr/lib/python2.5/logging, do you have the __init__.py file or only the .pyc? (Pydev needs the actual source files to work in the python library).

    Cheers,

    Fabio

     

  • Anonymous
    2010-06-07

    I have both the __init__.py and .pyc in /usr/lib/python2.5/logging and I can't find anything related to logging in the directories before it in the PYTHONPATH. Anything else I can look at?

    Thanks,
    John.

     

  • Anonymous
    2010-06-17

    I'm still having this problem. Any ideas? I really like the way pydev warns me about syntax errors and unused variables and such but when I get all these spurious errors it kind of detracts from it.

    John.

     
  • BreizhGatch
    BreizhGatch
    2010-06-24

    Hi John
    just to tell you i have the same problem… :-(… Pydev is complaining whereas every logging bits seems to be in place…

    on Windows, the python.exe works:

    Logging functions: 'BASIC_FORMAT,BufferingFormatter,CRITICAL,DEBUG,ERROR,FATAL,FileHandler,Filter,F
    ilterer,Formatter,Handler,INFO,LogRecord,Logger,Manager,NOTSET,PlaceHolder,RootL
    ogger,StreamHandler,WARN,WARNING,__author__,__builtins__,__date__,__doc__,__file
    __,__name__,__path__,__status__,__version__,_acquireLock,_defaultFormatter,_hand
    lerList,_handlers,_levelNames,_lock,_loggerClass,_releaseLock,_srcfile,_startTim
    e,addLevelName,atexit,basicConfig,cStringIO,codecs,critical,currentframe,debug,d
    isable,error,exception,fatal,getLevelName,getLogger,getLoggerClass,info,log,logP
    rocesses,logThreads,makeLogRecord,os,raiseExceptions,root,setLoggerClass,shutdow
    n,string,sys,thread,threading,time,traceback,types,warn,warning'
    Logging file: 'C:\\Program Files\\Python25\\lib\\logging\\__init__.py'

    but when i run the same module from a dos command prompt, I get this:

    Logging functions: __builtins__,__doc__,__file__,__name__,logging,sys
    Logging file: d:\Data\Dev\Eclipse\PyWorkshop\src\logging.pyc

    get stuck so far. so if anyone can help, I will appreciate…