From 0c596d5f91a95dc187beab2347cbe70efb55c38f Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Fri, 10 May 2019 22:43:24 +0530 Subject: [PATCH] Fixing utf-8 encoding when writing files. --- social.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/social.py b/social.py index 62afc90..6fe22ae 100644 --- a/social.py +++ b/social.py @@ -2,7 +2,6 @@ import helpers import requests from bs4 import BeautifulSoup from pathlib import Path -import codecs def getTweets(): @@ -107,7 +106,9 @@ def tootTheTweet(tweet): else: - tweet_check = codecs.open(tweet_check_file_path, mode='w', encoding='utf-8') + tweet['text'].encoding('utf-8') + + tweet_check = open(tweet_check_file_path, mode='w') tweet_check.write(tweet['text']) tweet_check.close()