From 3d5ace62a1fe01d73c18e1d0e23d23a71ee166f4 Mon Sep 17 00:00:00 2001 From: Celian Raimbault Date: Wed, 24 Apr 2024 10:29:09 +0200 Subject: [PATCH] [lint-licenses] Handled errors --- tasks/licenses.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasks/licenses.py b/tasks/licenses.py index 1d391673b5580..e65f11c5ca200 100644 --- a/tasks/licenses.py +++ b/tasks/licenses.py @@ -251,7 +251,10 @@ def find_copyright_for(package, overrides, ctx): for filename in COPYRIGHT_LOCATIONS: filename = os.path.join(pkgdir, filename) if os.path.isfile(filename): - for line in open(filename, encoding="utf-8"): + with open(filename, encoding="utf-8", errors="replace") as f: + lines = f.readlines() + + for line in lines: mo = COPYRIGHT_RE.search(line) if not mo: continue