From 462be040a6980f2be88d8f9bcad91e666805f8a2 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 9 Sep 2022 17:01:58 +0100 Subject: 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 Closes-bug: #1980383 Change-Id: I19b14c7f3b70bee5310cafcaa90fcee9003713c6 --- stevedore/_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.1