From 516fe5e478a01f3b4aa2729785038416a37f7a44 Mon Sep 17 00:00:00 2001 From: Zac Herd Date: Fri, 29 Apr 2016 10:20:42 +0100 Subject: [PATCH] Wrap stdout in default system encoding, v0.13.1 --- bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 72ac2c1..b9df63d 100644 --- a/bot.py +++ b/bot.py @@ -9,6 +9,8 @@ import discord import asyncio import os +import io +import sys import time import datetime import random @@ -27,7 +29,7 @@ from secret import token name = "Maki" # bot version -version = "v0.13.0" +version = "v0.13.1" # text shown by .help command helptext = """I am a bot written in Python by MrDetonia @@ -347,6 +349,8 @@ def on_message(message): else: print('ERROR: Failed to send message to discord after 5 attempts') +# Setup stdout encoding +sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding=sys.stdout.encoding, errors="backslashreplace", line_buffering=True) # Run the client client.run(token)