Skip to content

Commit aaf3b7d

Browse files
committed
Avoid IO races
1 parent 9871bd2 commit aaf3b7d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/element_tracking.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ def __init__(self, cache_path: Path) -> None:
1818
self.cache_path = cache_path
1919
self.elements: Dict[str, int] = {}
2020

21-
if cache_path.exists():
21+
try:
2222
self.elements = json.loads(cache_path.read_text())
23+
except IOError:
24+
pass
2325

2426
def __enter__(self) -> Dict[str, int]:
2527
return self.elements

0 commit comments

Comments
 (0)