From 334a96b6a57505d805d49ca8065f98d909012f35 Mon Sep 17 00:00:00 2001 From: YenForYang Date: Sat, 14 Dec 2024 18:27:12 -0600 Subject: [PATCH] Update utils.py Fix UnicodeDecodeError: 'charmap' codec can't decode byte ... in position ... --- drivefs_sleuth/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivefs_sleuth/utils.py b/drivefs_sleuth/utils.py index d4c96f7..42f8e17 100644 --- a/drivefs_sleuth/utils.py +++ b/drivefs_sleuth/utils.py @@ -36,7 +36,7 @@ def lookup_account_id(drivefs_path, account_id): for _, _, files in os.walk(logs_dir): for file in files: if file.startswith("drive_fs") and file.endswith(".txt"): - with open(os.path.join(logs_dir, file), 'r') as logs_file: + with open(os.path.join(logs_dir, file), 'r', encoding="utf8") as logs_file: logs = logs_file.read() match = re.search(r"([\w\.-]+@[\w\.-]+\.\w+) \(" + account_id + r"\)", logs) if match: