summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2022-09-09 17:01:58 +0100
committerStephen Finucane <stephenfin@redhat.com>2022-09-09 17:01:58 +0100
commit462be040a6980f2be88d8f9bcad91e666805f8a2 (patch)
treeceac89add483909f14300470f2c639c358e38ac6
parent55e9e1e5e880924b62867f152faa72e300cca451 (diff)
downloadstevedore-462be040a6980f2be88d8f9bcad91e666805f8a2.tar.gz
Catch NotADirectoryError error
Per the documentation [1]: exception NotADirectoryError Raised when a directory operation (such as os.listdir()) is requested on something which is not a directory. On most POSIX platforms, it may also be raised if an operation attempts to open or traverse a non-directory file as if it were a directory. Corresponds to errno ENOTDIR. Apparently creating a packaged application can cause this issue. There's no harm in ignoring it so do just that. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Closes-bug: #1980383 Change-Id: I19b14c7f3b70bee5310cafcaa90fcee9003713c6
-rw-r--r--stevedore/_cache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/stevedore/_cache.py b/stevedore/_cache.py
index 20b631d..a7a83cc 100644
--- a/stevedore/_cache.py
+++ b/stevedore/_cache.py
@@ -56,7 +56,7 @@ def _get_mtime(name):
s = os.stat(name)
return s.st_mtime
except OSError as err:
- if err.errno != errno.ENOENT:
+ if err.errno not in {errno.ENOENT, errno.ENOTDIR}:
raise
return -1.0