Message369209
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 |
|
Date |
User |
Action |
Args |
2020-05-18 12:47:57 | vstinner | set | recipients:
+ vstinner, lemburg, belopolsky, lukasz.langa, p-ganssle, gaborjbernat, FFY00 |
2020-05-18 12:47:57 | vstinner | set | messageid: <1589806077.54.0.431635105586.issue40536@roundup.psfhosted.org> |
2020-05-18 12:47:57 | vstinner | link | issue40536 messages |
2020-05-18 12:47:57 | vstinner | create | |
|