summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 471b380..4c1f2f9 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -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'):