[Python-projects] PyLint: Bogus message "Unable to import"

Markus Meyer meyer at mesw.de
Mon Jul 3 10:57:24 CEST 2006


Hi everyone,

first, thanks for PyLint, which has helped me a lot in the past to find
bugs in my code.

I got a problem with imports (confirmed in versions PyLint 0.11 and
0.8.1). Say I have the following code:

sys.path.append('/some/absolute/path/where/mylib/is/stored')
from mylib import somemodule

This works fine from within the Python interpreter, but PyLint throws an
error:

F: 15: Unable to import 'mylib.somemodule' (No module named mylib)

Using just "import mylib" doesn't throw a PyLint error, though.

Please find attached an archive which contains a very minimal sample to
reproduce the problem (with a lib/ directory, a minimal module etc.).
Run the following command to reproduce the problem:

pylint --reports=n test.py

Run

python test.py

to see that the import actually works from within the Python interpreter.

Any ideas on how to work around this? Is this a bug?


Markus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pylintproblem.tar.bz2
Type: application/x-bzip
Size: 669 bytes
Desc: not available
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20060703/b8d16831/pylintproblem.tar.bin


More information about the Python-Projects mailing list