[issue15912] Intermittent import failure

Eric Snow report at bugs.python.org
Mon Sep 10 22:28:16 CEST 2012


Eric Snow added the comment:

The FileFinder class (a "path entry finder") uses a cache to efficiently track changes to files.  You can manually clear this cache by calling importlib.invalidate_caches().  The Python test suite has several examples of clearing the FileFinder cache in this way.

I've verified the failure as described.  Using importlib.invalidate_caches() at the spot where the script cleans up sys.modules, the failure goes away.

Depending on OS filesystem timestamp resolution, you could see the behavior just as you've described it.  Since normally you wouldn't remove and re-add modules like this, it isn't normally an issue.

----------
nosy: +eric.snow
stage:  -> test needed
type:  -> behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15912>
_______________________________________


More information about the Python-bugs-list mailing list