From 237078e2e6ab966579c11f971205086b46664775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9lian=20Raimbault?= <161456554+CelianR@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:29:16 +0200 Subject: [PATCH] [lint-licenses] Handled errors (#25045) --- 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