[Python-projects] Pylint: bugreport: unhandled ImportError

Michał Kwiatkowski constant.beta at gmail.com
Tue Jul 25 01:40:14 CEST 2006


Hi,

Consider this simple directory structure:

$ find
.
./foo
./foo/bar
./foo/bar/module.py
./foo/bar/__init__.py

Both __init__.py and module.py can be empty files. Now, when executing
pylint like in example below causes an unhandled ImportError and
scoring of a package is terminated:

$ pylint foo/bar/
No config file found, using default configuration
************* Module
C:  0: Invalid name "" (should match (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$)
C:  0: Missing docstring
C:  0: Missing required attribute "__revision__"
Traceback (most recent call last):
  File "/usr/bin/pylint", line 4, in ?
    lint.Run(sys.argv[1:])
  File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 828, in __init__
    linter.check(args)
  File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 476, in check
    self.check_file(filepath, modname, checkers)
  File "/usr/lib/python2.3/site-packages/pylint/lint.py", line 499, in
check_file
    modname = '.'.join(modpath_from_file(filepath))
  File "/usr/lib/python2.3/site-packages/logilab/common/modutils.py",
line 169, in modpath_from_file
    raise ImportError('Unable to find module for %s in %s' % (
ImportError: Unable to find module for foo/bar/module.py in /tmp/pylint_example,
/usr/bin,
/usr/lib/python2.3/site-packages/CVSToys-1.0.9-py2.3.egg,
/usr/lib/python2.3/site-packages/nose-0.9.1.dev_r77-py2.3.egg,
/usr/lib/python23.zip,
/usr/lib/python2.3,
/usr/lib/python2.3/plat-linux2,
/usr/lib/python2.3/lib-tk,
/usr/lib/python2.3/lib-dynload,
/usr/local/lib/python2.3/site-packages,
/usr/lib/python2.3/site-packages,
/usr/lib/python2.3/site-packages/Numeric,
/usr/lib/python2.3/site-packages/PIL,
/usr/lib/python2.3/site-packages/cairo,
/usr/lib/python2.3/site-packages/gtk-2.0,
/var/lib/python-support/python2.3,
/usr/lib/python2.3/site-packages/setuptools-0.6b3-py2.3.egg,
/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode,
/usr/lib/site-python

Version info:

$ pylint --version
No config file found, using default configuration
pylint 0.11.0,
astng 0.16.0, common 0.16.1
Python 2.3.5 (#2, Jun 13 2006, 23:12:55)
[GCC 4.1.2 20060613 (prerelease) (Debian 4.1.1-4)]

Cheers,
mk
-- 
 . o .       >>  http://joker.linuxstuff.pl  <<
 . . o   It's easier to get forgiveness for being wrong
 o o o   than forgiveness for being right.


More information about the Python-Projects mailing list