x4zx
@x4zx
python developer

Как произвести деплой бота дискорд используя коги?

Сделал бота дискорд, решил провести деплой на хероку, я использую коги и поэтому в логах на сайте хероку мне выдает подобную ошибку, кто сталкивался подскажите пожалуйста что делать?

Ошибка:
2021-08-19T11:08:16.350708+00:00 heroku[worker.1]: Starting process with command `python bot.py`
2021-08-19T11:08:16.952950+00:00 heroku[worker.1]: State changed from starting to up
2021-08-19T11:08:18.269473+00:00 heroku[worker.1]: Process exited with status 1
2021-08-19T11:08:18.203652+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-19T11:08:18.203666+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 606, in _load_from_module_spec
2021-08-19T11:08:18.203840+00:00 app[worker.1]:     spec.loader.exec_module(lib)
2021-08-19T11:08:18.203849+00:00 app[worker.1]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2021-08-19T11:08:18.203911+00:00 app[worker.1]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-08-19T11:08:18.203956+00:00 app[worker.1]:   File "/app/cogs/info.py", line 7, in <module>
2021-08-19T11:08:18.204020+00:00 app[worker.1]:     locale.setlocale(0, "ru-ru")
2021-08-19T11:08:18.204028+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/locale.py", line 610, in setlocale
2021-08-19T11:08:18.204176+00:00 app[worker.1]:     return _setlocale(category, locale)
2021-08-19T11:08:18.204197+00:00 app[worker.1]: locale.Error: unsupported locale setting
2021-08-19T11:08:18.204204+00:00 app[worker.1]: 
2021-08-19T11:08:18.204205+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-08-19T11:08:18.204205+00:00 app[worker.1]: 
2021-08-19T11:08:18.204206+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-19T11:08:18.204208+00:00 app[worker.1]:   File "/app/bot.py", line 96, in <module>
2021-08-19T11:08:18.204282+00:00 app[worker.1]:     bot.load_extension(f"cogs.{filename[:-3]}")
2021-08-19T11:08:18.204290+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 663, in load_extension
2021-08-19T11:08:18.204441+00:00 app[worker.1]:     self._load_from_module_spec(spec, name)
2021-08-19T11:08:18.204443+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 609, in _load_from_module_spec
2021-08-19T11:08:18.204581+00:00 app[worker.1]:     raise errors.ExtensionFailed(key, e) from e
2021-08-19T11:08:18.204602+00:00 app[worker.1]: discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.info' raised an error: Error: unsupported locale setting
2021-08-19T11:08:18.352328+00:00 heroku[worker.1]: State changed from up to crashed
2021-08-19T11:08:18.426905+00:00 heroku[worker.1]: State changed from crashed to starting
2021-08-19T11:08:25.598607+00:00 heroku[worker.1]: Starting process with command `python bot.py`
2021-08-19T11:08:26.206331+00:00 heroku[worker.1]: State changed from starting to up
2021-08-19T11:08:28.045198+00:00 heroku[worker.1]: Process exited with status 1
2021-08-19T11:08:27.902093+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-19T11:08:27.902111+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 606, in _load_from_module_spec
2021-08-19T11:08:27.902286+00:00 app[worker.1]:     spec.loader.exec_module(lib)
2021-08-19T11:08:27.902288+00:00 app[worker.1]:   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
2021-08-19T11:08:27.902355+00:00 app[worker.1]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
2021-08-19T11:08:27.902408+00:00 app[worker.1]:   File "/app/cogs/info.py", line 7, in <module>
2021-08-19T11:08:27.902471+00:00 app[worker.1]:     locale.setlocale(0, "ru-ru")
2021-08-19T11:08:27.902472+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/locale.py", line 610, in setlocale
2021-08-19T11:08:27.902620+00:00 app[worker.1]:     return _setlocale(category, locale)
2021-08-19T11:08:27.902642+00:00 app[worker.1]: locale.Error: unsupported locale setting
2021-08-19T11:08:27.902649+00:00 app[worker.1]: 
2021-08-19T11:08:27.902650+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-08-19T11:08:27.902650+00:00 app[worker.1]: 
2021-08-19T11:08:27.902651+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-19T11:08:27.902658+00:00 app[worker.1]:   File "/app/bot.py", line 96, in <module>
2021-08-19T11:08:27.902745+00:00 app[worker.1]:     bot.load_extension(f"cogs.{filename[:-3]}")
2021-08-19T11:08:27.902748+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 663, in load_extension
2021-08-19T11:08:27.902905+00:00 app[worker.1]:     self._load_from_module_spec(spec, name)
2021-08-19T11:08:27.902913+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 609, in _load_from_module_spec
2021-08-19T11:08:27.903100+00:00 app[worker.1]:     raise errors.ExtensionFailed(key, e) from e
2021-08-19T11:08:27.903126+00:00 app[worker.1]: discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.info' raised an error: Error: unsupported locale setting
2021-08-19T11:08:28.122067+00:00 heroku[worker.1]: State changed from up to crashed
  • Вопрос задан
  • 124 просмотра
Решения вопроса 1
Vindicar
@Vindicar
RTFM!
locale.Error: unsupported locale setting
Передал в locale.setlocale() неверное/неизвестное имя локали.

locale.setlocale(0, "ru-ru")
ЧТД. Локаль правильно называется "ru_ru".

Так что дело не в когах, дело в том что у тебя локаль кривая, а исключение не ловится.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы