From 1de7216ef4a32a05280d40c82e2365179257ffd3 Mon Sep 17 00:00:00 2001 From: CiriloRibeiro Date: Thu, 7 Sep 2023 14:53:01 -0300 Subject: [PATCH] The following error message is returned with the current code (line 34). UnicodeDecodeError: 'utf-8' codec can't decode byte 0xac in position 6693: invalid start byte The code was updated with the encoding below: in_file = open("HDTdata4.txt", "r", encoding="latin-1") --- Source Code/HDT.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source Code/HDT.py b/Source Code/HDT.py index 7afd1b0..39c9a8e 100644 --- a/Source Code/HDT.py +++ b/Source Code/HDT.py @@ -29,7 +29,9 @@ def update_pvs(word, pv, id, word_count_dict, word_pv_dict, min_pv_dict, max_pv_ articlepv = list() sum_pv = 0 ID = 0 -in_file = open("HDTdata4.txt", "r") +in_file = open("HDTdata4.txt", "r", encoding="latin-1") # Specify the correct encoding + + for line in in_file: if ID == 0: # excluding first line as it is header