[issue14846] Change in error when sys.path contains a nonexistent folder (importlib)
report at bugs.python.org
Fri May 18 02:15:50 CEST 2012
Eric Snow <ericsnowcurrently at gmail.com> added the comment:
The caching mechanism is going to check for changes in the directory. So the recommendation is to clear the cache manually:
The default finders used by import now utilize a cache of what is contained
within a specific directory. If you create a Python source file or sourceless
bytecode file, make sure to call importlib.invalidate_caches() to clear out
the cache for the finders to notice the new file.
That section doesn't really talk about the directory side of things, but calling importlib.invalidate_caches() works great to eliminate the error in your example.
nosy: +brett.cannon, eric.snow, pitrou
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list