Close #14846: Handle a sys.path entry going away

This commit is contained in:
Nick Coghlan 2012-08-20 13:18:15 +10:00
parent db7920b978
commit 48fec05391
4 changed files with 957 additions and 937 deletions

View file

@ -1367,7 +1367,11 @@ class FileFinder:
def _fill_cache(self):
"""Fill the cache of potential modules and packages for this directory."""
path = self.path
contents = _os.listdir(path)
try:
contents = _os.listdir(path)
except FileNotFoundError:
# Directory has been removed since last import
contents = []
# We store two cached versions, to handle runtime changes of the
# PYTHONCASEOK environment variable.
if not sys.platform.startswith('win'):