From 5dfd167bc057a2fada2dc511ade1ac6b4df56a38 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 23 Feb 2019 10:34:22 +1000 Subject: [PATCH] hopefully fixed #13 by auto converting to ASCII --- gen.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gen.py b/gen.py index 3143e39..aa762e3 100755 --- a/gen.py +++ b/gen.py @@ -36,4 +36,7 @@ if __name__ == '__main__': "toot": "An unknown error that should never happen occurred. Maybe it's because of the spoiler text, which is {}. If not, I have no idea what went wrong. This is an error message -- contact lynnesbian@fedi.lynnesbian.space for assistance.".format(cfg['cw']) } client.status_post(toot['toot'], visibility = 'unlisted', spoiler_text = "Error!") - print(toot['toot']) + try: + print(toot['toot']) + except UnicodeEncodeError: + print(toot['toot'].encode("ascii", "ignore")) # encode as ASCII, dropping any non-ASCII characters