STINNER Victor <vstin...@python.org> added the comment:
def valid_key(fpath): try: with open(fpath, "rb") as f: return f.read(4) == b"TZif" except Exception: # pragma: nocover return False Why not only catching "except OSError:" rather than any exception? Or even "except (FileNotFoundError, PermissionError):" if you want to be pedantic :-p ---------- nosy: +vstinner _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40536> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com