Issue 23412: importlib sometimes fails to import a recently created module (original) (raw)
importlib.import_module() sometimes fails to import a module that has just been written to the filesystem, aborting with an ImportError.
Example output when executing the attached file with Python 3.3 or 3.4:
Wrote tmpwbzb35.py Successfully imported tmpwbzb35 Wrote tmp34c6qs.py Traceback (most recent call last): File "importerror.py", line 12, in importlib.import_module(modname) File "/home/rjd/Python/Python3.3/lib/python3.3/importlib/init.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1577, in _gcd_import File "", line 1558, in _find_and_load File "", line 1522, in _find_and_load_unlocked ImportError: No module named 'tmp34c6qs'
I have been unable to reproduce this behaviour with Python 2.7 or Python 3.2.