From 91a325e937c8c5d19a0e04682c4043a7dde3ea41 Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Tue, 30 Apr 2019 21:25:18 +0530 Subject: [PATCH] Adding fix for writing UTF-8 encoded strings when keeping tweet history --- social.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/social.py b/social.py index 1125e3d..08564c6 100644 --- a/social.py +++ b/social.py @@ -2,6 +2,7 @@ import helpers import requests from bs4 import BeautifulSoup from pathlib import Path +import codecs def getTweets(): @@ -97,7 +98,7 @@ def tootTheTweet(tweet): else: - tweet_check = open(tweet_check_file_path, 'w') + tweet_check = codecs.open(tweet_check_file_path, mode='w', encoding='utf-8') tweet_check.write(tweet['text']) tweet_check.close()