From 3dce207aa68f9aa560c51436069a2501f32c58aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gilles?= <sebastien.gilles@inria.fr> Date: Thu, 29 Apr 2021 18:06:36 +0200 Subject: [PATCH] Script to check notebooks: remove the she-bang and add two arguments to circumvent an issue with UTF 8 encoding (fix suggested there: https://www.journaldunet.fr/web-tech/developpement/1441055-corriger-l-erreur-unicodedecodeerror-utf-8-codec-can-t-decode-byte-0xff-in-position-0-invalid-start-byte/). --- Scripts/check_no_executed_cell.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Scripts/check_no_executed_cell.py b/Scripts/check_no_executed_cell.py index 7a91631..93ca3db 100644 --- a/Scripts/check_no_executed_cell.py +++ b/Scripts/check_no_executed_cell.py @@ -1,5 +1,3 @@ -#!python - import argparse import sys from typing import Optional @@ -8,7 +6,7 @@ from typing import Sequence def find_executed_cell(filename): """Read the file and check whether there is a line with "execution_count" and a non null value.""" - stream = open(filename) + stream = open(filename, encoding="utf8", errors='ignore') executed_cells = [line.strip("\n,\" ") for line in stream if "execution_count" in line and "null" not in line ] -- GitLab