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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user