hopefully fixed #13 by auto converting to ASCII

This commit is contained in:
Lynne 2019-02-23 10:34:22 +10:00 committed by GitHub
parent d7c69c83f0
commit 5dfd167bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

3
gen.py
View File

@ -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!")
try:
print(toot['toot'])
except UnicodeEncodeError:
print(toot['toot'].encode("ascii", "ignore")) # encode as ASCII, dropping any non-ASCII characters