[issue31741] backports import path can not be overridden in Windows (Linux works fine)

Paul Moore report at bugs.python.org
Thu Oct 12 03:45:58 EDT 2017


Paul Moore <p.f.moore at gmail.com> added the comment:

Also, one of the packages installed creates a file

configparser-3.5.0-py2.7-nspkg.pth

This has some very suspicious looking content:

import sys, types, os;has_mfs = sys.version_info > (3, 5);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('backports',)); importlib = has_mfs and __import__('importlib.util');has_mfs and __import__('importlib.machinery');m = has_mfs and sys.modules.set default('backports', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('backports', [os.path.dirname(p)]))) ;m = m or sys.modules.setdefault('backports', types.ModuleType('backports'));mp = (m or []) and m.__dict__.setdefault('__path__',[ ]);(p not in mp) and mp.append(p)

That's likely your problem. I've no idea what it's doing, but as Zachary says, the backports module is a strange beast...

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31741>
_______________________________________


More information about the Python-bugs-list mailing list