alloploha / Beacons-DiscordBot

A roster of Haven & Hearth MMORPG Wilderness Beacons.
GNU General Public License v2.0
1 stars 4 forks source link

Ошибка кодировки текста. Найдено в логах. #2

Open alloploha opened 3 years ago

alloploha commented 3 years ago
[04/02/2021 21:04:27 > 68a25d: ERR ] Ignoring exception in command \u0443\u0434\u0430\u043b\u0438\u0442\u044c:
[04/02/2021 21:04:27 > 68a25d: ERR ] Traceback (most recent call last):
[04/02/2021 21:04:27 > 68a25d: ERR ]   File "C:\home\python364x64\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
[04/02/2021 21:04:27 > 68a25d: ERR ]     ret = await coro(*args, **kwargs)
[04/02/2021 21:04:27 > 68a25d: ERR ]   File "BeaconsBot.py", line 71, in close_beacon
[04/02/2021 21:04:27 > 68a25d: ERR ]     print(f'{ctx.author.name} put out beacon \"{password}\"')
[04/02/2021 21:04:27 > 68a25d: ERR ]   File "E:\A\_work\79\b\source_packages\python.3.6.4\tools\Lib\encodings\cp1252.py", line 19, in encode
[04/02/2021 21:04:27 > 68a25d: ERR ] UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-8: character maps to <undefined>
[04/02/2021 21:04:27 > 68a25d: ERR ] 
[04/02/2021 21:04:27 > 68a25d: ERR ] The above exception was the direct cause of the following exception:
[04/02/2021 21:04:27 > 68a25d: ERR ] 
[04/02/2021 21:04:27 > 68a25d: ERR ] Traceback (most recent call last):
[04/02/2021 21:04:27 > 68a25d: ERR ]   File "C:\home\python364x64\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
[04/02/2021 21:04:27 > 68a25d: ERR ]     await ctx.command.invoke(ctx)
[04/02/2021 21:04:27 > 68a25d: ERR ]   File "C:\home\python364x64\lib\site-packages\discord\ext\commands\core.py", line 864, in invoke
[04/02/2021 21:04:27 > 68a25d: ERR ]     await injected(*ctx.args, **ctx.kwargs)
[04/02/2021 21:04:27 > 68a25d: ERR ]   File "C:\home\python364x64\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
[04/02/2021 21:04:27 > 68a25d: ERR ]     raise CommandInvokeError(exc) from exc
[04/02/2021 21:04:27 > 68a25d: ERR ] discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-8: character maps to <undefined>
alloploha commented 3 years ago

71- я строка:

print(f'{ctx.author.name} put out beacon \"{password}\"')

Похоже что падает при выводе в консоль, которая не имеет русского языка (а её там и нет, конечно).

alloploha commented 3 years ago

Добавил переменную окружения в Web App на Staging и Production. PYTHONIOENCODING=UTF-8 Наблюдать логи. Появится ли ошибка снова.