[issue23412] importlib sometimes fails to import a recently created module

Richard Dymond report at bugs.python.org
Sun Feb 8 16:43:35 CET 2015


New submission from Richard Dymond:

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 <module>
    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 "<frozen importlib._bootstrap>", line 1577, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", 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.

----------
files: importerror.py
messages: 235557
nosy: rjdymond
priority: normal
severity: normal
status: open
title: importlib sometimes fails to import a recently created module
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file38046/importerror.py

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


More information about the Python-bugs-list mailing list