pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

IOError (never happened before new version was released). #46

Closed pylint-bot closed 8 years ago

pylint-bot commented 11 years ago

Originally reported by: BitBucket: dotpot, GitHub: @dotpot?


It's all started after 1.0.0 release (0.28.0 now is not working as well (as it was working before 1.0.0 release), might be some dependant libs change on pylint end).

So pylint fails due to IOError and "missing" imports, BUT nosetests (running in the same environment) passes everything (in tests, classes using scipy are tested as well - so imports exists and everything is fine).

Here is traceback:

#!bash
$ pylint --rcfile=pylintrc ./ourProject
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 284, in getattr
    return [self.import_module(name, relative_only=True)]
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 339, in import_module
    return MANAGER.ast_from_module_name(absmodname)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/manager.py", line 121, in ast_from_module_name
    filepath = self.file_from_module_name(modname, context_file)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/manager.py", line 165, in file_from_module_name
    context_file=contextfile)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/logilab/common/modutils.py", line 295, in file_from_modpath
    return _file_from_modpath(modpath, path, context)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/logilab/common/modutils.py", line 554, in _file_from_modpath
    mtype, mp_filename = _module_file(modpath, path)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/logilab/common/modutils.py", line 659, in _module_file
    data = open(join(mp_filename, '__init__.py')).read(4096)
IOError: [Errno 2] No such file or directory: '/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/scipy/__init__.py'
************* Module ourProject.xx.xx.xxx
E:  7, 0: No name 'cluster' in module 'scipy' (no-name-in-module)
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7/bin/pylint", line 9, in <module>
    load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/__init__.py", line 21, in run_pylint
    Run(sys.argv[1:])
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/lint.py", line 1010, in __init__
    linter.check(args)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/lint.py", line 599, in check
    self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/lint.py", line 685, in check_astroid_module
    walker.walk(astroid)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/utils.py", line 662, in walk
    self.walk(child)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/utils.py", line 659, in walk
    cb(astroid)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/checkers/imports.py", line 228, in visit_import
    importedmodnode = self.get_imported_module(modnode, node, name)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/pylint/checkers/imports.py", line 266, in get_imported_module
    return importnode.do_import_module(modname)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/mixins.py", line 103, in do_import_module
    return mymodule.import_module(modname, level=level)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/scoped_nodes.py", line 345, in import_module
    return MANAGER.ast_from_module_name(modname)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/manager.py", line 121, in ast_from_module_name
    filepath = self.file_from_module_name(modname, context_file)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/astroid/manager.py", line 165, in file_from_module_name
    context_file=contextfile)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/logilab/common/modutils.py", line 295, in file_from_modpath
    return _file_from_modpath(modpath, path, context)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/logilab/common/modutils.py", line 554, in _file_from_modpath
    mtype, mp_filename = _module_file(modpath, path)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/logilab/common/modutils.py", line 659, in _module_file
    data = open(join(mp_filename, '__init__.py')).read(4096)
IOError: [Errno 2] No such file or directory: '/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/scipy/__init__.py'

Any ideas? Solutions?


pylint-bot commented 11 years ago

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


looks like the bug lies in logilab.common.modutils._module_file when it attempts to look at the init.py file content. The file doesn't exist in your case. I would be curious to understand why, but in the mean time you should add some try/except IOError (or os.path.exists) around the open() call.

pylint-bot commented 11 years ago

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


Will be fixed in the next logilab-common release. See http://www.logilab.org/ticket/174606 for more info and patch