From b87ccf6c52311bc65f740d712b967db880e1d8f8 Mon Sep 17 00:00:00 2001 From: Mark Cramer Date: Thu, 18 Jan 2018 21:33:30 -0800 Subject: [PATCH] fix UnicodeDecodeError added encoding="utf8" to open(filepath, encoding="utf8") in datasource.py in order to avoid "UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 4562891: character maps to " --- datasource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasource.py b/datasource.py index bc79297..2eb1a3a 100644 --- a/datasource.py +++ b/datasource.py @@ -8,7 +8,7 @@ def load_json_files(datasource_name_and_location, verbose=False): # Load data into memory (our data is small enough to safely fit in memory) scraped_pages = {} for name, filepath in datasource_name_and_location: - with open(filepath) as json_data: + with open(filepath, encoding="utf8") as json_data: scraped_pages[name] = json.load(json_data) if verbose: