From 3d1965379c48033a94f5a4caaa17b39005871666 Mon Sep 17 00:00:00 2001 From: ndokas99 <54295411+ndokas99@users.noreply.github.com> Date: Mon, 29 Jun 2020 17:33:53 +0200 Subject: [PATCH] Made changes due to Errors Changed the encoding used to open text file due to UnicodeDecodeError in 'charmap' Changed paths to work for Windows as FileNotFoundError was being raised. --- aux_functions.py | 5 +++-- main.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/aux_functions.py b/aux_functions.py index 1ec4116..fb9aa84 100644 --- a/aux_functions.py +++ b/aux_functions.py @@ -141,7 +141,7 @@ def plot_time_circle(time, count, title, save_path): footer_text = "www.aqeel-anwar.com/AnalyzeTheChat" plt.figtext(0.55, 0.98, footer_text) - name = save_path[0] + "/" + title + "." + save_path[1] + name = save_path[0] + "\\" + title + "." + save_path[1] # plt_bytes = buf.getvalue() # buf.close() @@ -196,7 +196,8 @@ def plot_bar(x, y, title, save_path, max_limit=0): small = cv2.cvtColor(small, cv2.COLOR_BGR2RGB) height = small.shape[0] f.figimage(small, 5, f.bbox.ymax - 1.4 * height) - name = save_path[0] + "/" + title + "." + save_path[1] + name = save_path[0] + "\\" + title + "." + save_path[1] + name = name.replace('-','').replace('<','') footer_text = "www.aqeel-anwar.com/AnalyzeTheChat" plt.figtext(0.75, 0.98, footer_text) print(name) diff --git a/main.py b/main.py index f376e89..ad1d605 100644 --- a/main.py +++ b/main.py @@ -38,7 +38,7 @@ def process_chat(file_path): args = parser.parse_args() args.path = file_path - chat = open(args.path, mode="r") + chat = open(args.path, mode="r", encoding='utf-8') chat = chat.read() st = T.time() df, df_extended = crawl_the_chat(chat)