Heya,
I'm trying to use pylint3 on a bunch of Python 3 modules that use PEP
420 implicit namespaces. All imports work just fine outside of pylint,
but most of them fail with an ImportError within pylint and I don't
understand why.
My understanding from the issue tracker was that this issue should've
been solved in the version of pylint I'm using. So either it's not, or
I'm missing something :)
A sample of the issues I'm facing is reported below.
Advice welcome!
zack@scaramouche:~$ pylint3 --version
pylint3 1.7.2,
astroid 1.5.3
Python 3.5.4 (default, Aug 12 2017, 14:08:14)
[GCC 7.1.0]
zack@scaramouche:~/swh/git/swh-environment/swh-model$ ls swh/model/
exceptions.py fields git.py hashutil.py identifiers.py __init__.py __pycache__ tests validators.py
zack@scaramouche:~/swh/git/swh-environment/swh-model$ ls -l swh/model/__init__.py
-rw-r--r-- 1 zack zack 0 ago 29 12:53 swh/model/__init__.py
zack@scaramouche:~/swh/git/swh-environment/swh-model$ python3
Python 3.5.4 (default, Aug 12 2017, 14:08:14)
[GCC 7.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import swh.model
>>> import swh.model.git
>>> import swh.model.hashutil
>>>
So all works well with "pure" python3. Now let's see with pylint3:
zack@scaramouche:~/swh/git/swh-environment/swh-model$ pylint3 swh.model.hashutil > /dev/null
zack@scaramouche:~/swh/git/swh-environment/swh-model$ pylint3 swh.model.git > /dev/null
The above ones work, when loading leaf modules.
Loading the upper module "swh.model" doesn't work though:
zack@scaramouche:~/swh/git/swh-environment/swh-model$ pylint3 swh.model > /dev/null
Traceback (most recent call last):
File "/home/zack/bin/pylint3", line 11, in <module>
sys.exit(run_pylint())
File "/home/zack/.local/lib/python3.5/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/home/zack/.local/lib/python3.5/site-packages/pylint/lint.py", line 1300, in __init__
linter.check(args)
File "/home/zack/.local/lib/python3.5/site-packages/pylint/lint.py", line 726, in check
self._do_check(files_or_modules)
File "/home/zack/.local/lib/python3.5/site-packages/pylint/lint.py", line 837, in _do_check
for descr in self.expand_files(files_or_modules):
File "/home/zack/.local/lib/python3.5/site-packages/pylint/lint.py", line 869, in expand_files
self.config.black_list_re)
File "/home/zack/.local/lib/python3.5/site-packages/pylint/utils.py", line 894, in expand_modules
modpath = _modpath_from_file(subfilepath, is_namespace)
File "/home/zack/.local/lib/python3.5/site-packages/pylint/utils.py", line 833, in _modpath_from_file
return modutils.modpath_from_file_with_callback(filename, is_package_cb=_is_package_cb)
File "/home/zack/.local/lib/python3.5/site-packages/astroid/modutils.py", line 310, in modpath_from_file_with_callback
filename, ', \n'.join(sys.path)))
ImportError: Unable to find module for /home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model/swh/model/hashutil.py in /home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model,
.,
/home/zack/.local/bin,
/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-archiver,
[ long list of PYTHONPATH entries snipped ]
Any idea?
Cheers.
--
Stefano Zacchiroli . zack(a)upsilon.cc . upsilon.cc/zack . . o . . . o . o
Computer Science Professor . CTO Software Heritage . . . . . o . . . o o
Former Debian Project Leader & OSI Board Director . . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »