From a7528a0a2951e8f1c9d570ca6d0262d00ab4c6c4 Mon Sep 17 00:00:00 2001 From: Luca Hammer Date: Mon, 4 Dec 2017 11:42:27 +0100 Subject: [PATCH] Explicit utf-8 encoding of the CSV Fixes the following error: "UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f609' in position 272: character maps to " --- get_fb_posts_fb_page.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get_fb_posts_fb_page.py b/get_fb_posts_fb_page.py index 812a074..4617962 100644 --- a/get_fb_posts_fb_page.py +++ b/get_fb_posts_fb_page.py @@ -124,7 +124,7 @@ def processFacebookPageFeedStatus(status): def scrapeFacebookPageFeedStatus(page_id, access_token, since_date, until_date): - with open('{}_facebook_statuses.csv'.format(page_id), 'w') as file: + with open('{}_facebook_statuses.csv'.format(page_id), 'w', encoding='utf-8') as file: w = csv.writer(file) w.writerow(["status_id", "status_message", "link_name", "status_type", "status_link", "status_published", "num_reactions",