From 26baa3b1b179f01aa83ccff51ec2b422e4f291d9 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Wed, 29 Nov 2017 17:05:09 +0100 Subject: [PATCH] Change str() to encode('utf-8') Some error don't be displayed with Mastodon.py because it can't convert ascii with str(). So I change str to encode(utf-8) --- mastodon/Mastodon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 91e6b11..2de82dc 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -1190,7 +1190,7 @@ class Mastodon: raise MastodonAPIError('Endpoint not found.') if isinstance(response, dict) and 'error' in response: - raise MastodonAPIError("Mastodon API returned error: " + str(response['error'])) + raise MastodonAPIError("Mastodon API returned error: " + response['error'].encode('utf-8').strip()) else: raise MastodonAPIError('Endpoint not found.')