On 03 octobre 07:51, Mats Hallingström wrote: > Hi Code Quality Hi Mats, > This may already be a reported bug, but then i need help in finding that > issue. > > > Situation: > I invoke pylint with : > > from pylint.lint import Run > ... > > files = [ 'subdir/a.py', 'b.py' ] > > for file in files: > status = Run(['-E'] + > ['--rcfile', 'pylintrc'] + > [file], exit=False) > ## To keep separate records of each file > > Problem: > both files have this import > import config.tc > It runs well because the module config is in the sys.path when run. > > But pylint reports for subdir/a.py AND b.py > E: 16,0: No name 'tc' in module 'config' > > If I revers the order of the files pylint reports OK for BOTH, probably > because config.tc matches the path from root directory of b.py, and then > when I check subdir/a.py, pylint somehow have a memory of the import. > > Run totally separately, only subdir/a.py reports problem with the import of > config.tc. > > I don't want the order of the files to matter due to that pylint keeps a > memory of the previous files imports and search paths. How do I clean out > the imports between the files?
from astroid import MANAGER MANAGER.clear_cache() should do the trick. -- Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework: http://www.cubicweb.org _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality