[Python-Dev] Failures in test_site.py - how to debug? (original) (raw)

Steve Dower steve.dower at python.org
Fri Aug 19 12:25:43 EDT 2016


On 19Aug2016 0910, Chris Angelico wrote:

On Sat, Aug 20, 2016 at 1:26 AM, Steve Dower <steve.dower at python.org> wrote:

Check any .pth files you can find. I suspect mpltoolkits has some magic in it to make the namespace package work on 2.7. $ cat /usr/local/lib/python3.6/site-packages/matplotlib-1.5.1-py3.6-nspkg.pth import sys, types, os;p = os.path.join(sys.getframe(1).flocals['sitedir'], *('mpltoolkits',));ie = os.path.exists(os.path.join(p,'init.py'));m = not ie and sys.modules.setdefault('mpltoolkits', types.ModuleType('mpltoolkits'));mp = (m or []) and m.dict.setdefault('path',[]);(p not in mp) and mp.append(p) Is it possible that that's the cause? And if so, should "python -I" remove /usr/local/lib/python3.6/site-packages from sys.path?

That explains the extra modules - types.py imports collections and collections.abc, which would seem to account for the rest.

I'm not sure whether that's causing the problem or not, but temporarily renaming that pth file so it isn't picked up may help you track down the test issue.

"python -S" is the only way to avoid .pth files, but that's a pretty heavy hammer.

Cheers, Steve



More information about the Python-Dev mailing list