[issue20321] ImportError when a module is created after a catched ImportError
Brett Cannon
report at bugs.python.org
Tue Jan 21 14:45:38 CET 2014
Brett Cannon added the comment:
I'm not sure why you think the example code as-is should work. The first entry on sys.path is the current directory ('' or the absolute path, depending if you are running from the interpreter prompt or specifying a file on the command-line). Stripping off sys.path[0] guarantees the example code will not work.
And as for why adding in '.' works on PyPy and not Python 3.3, it's because you didn't call importlib.invalidate_caches() to clear out the directory modification, so Python didn't notice that the file was added because the mtime granularity for directories it larger than the time it took to have the import for it_does_not_exist fail, write the impfile.py file, and to try importing again.
----------
assignee: -> brett.cannon
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20321>
_______________________________________
More information about the Python-bugs-list
mailing list