Levman5
@Levman5
print(“Hello World!”)

Не работает pythonanywhere. Что делать?

Я запускаю телеграмм бота на pythonanywhere, a он выдаёт ошибку:
18:20 ~ $ python t2bot.py
WARNING:aiogram:Goodbye!
Traceback (most recent call last):
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "uvloop/loop.pyx", line 2024, in create_connection
  File "uvloop/loop.pyx", line 2000, in uvloop.loop.Loop.create_connection
  File "uvloop/handles/tcp.pyx", line 182, in uvloop.loop.TCPTransport.connect
  File "uvloop/handles/tcp.pyx", line 204, in uvloop.loop._TCPConnectRequest.connect
OSError: [Errno 101] Network is unreachable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/bot/api.py", line 139, in make_request
    async with session.post(url, data=req, **kwargs) as response:
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/levman/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Network is unreachable]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/levman/t2bot.py", line 123, in <module>
    executor.start_polling(dp, skip_updates=True)
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/utils/executor.py", line 45, in start_polling
    executor.start_polling(
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/utils/executor.py", line 320, in start_polling
    loop.run_until_complete(self._startup_polling())
  File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/utils/executor.py", line 371, in _startup_polling
    await self._welcome()
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/utils/executor.py", line 361, in _welcome
    user = await self.dispatcher.bot.me
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/bot/bot.py", line 29, in me
    setattr(self, '_me', await self.get_me())
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/bot/bot.py", line 215, in get_me
    result = await self.request(api.Methods.GET_ME, payload)
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/bot/base.py", line 208, in request
    return await api.make_request(self.session, self.server, self.__token, method, data, files,
  File "/home/levman/.local/lib/python3.9/site-packages/aiogram/bot/api.py", line 142, in make_request
    raise exceptions.NetworkError(f"aiohttp client throws an error: {e.__class__.__name__}: {e}")
aiogram.utils.exceptions.NetworkError: Aiohttp client throws an error: ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default
 [Network is unreachable]


Причём на локалке всё работало.
В чём ошибка?
  • Вопрос задан
  • 1289 просмотров
Пригласить эксперта
Ответы на вопрос 2
SoreMix
@SoreMix Куратор тега Python
yellow
DenysPlakhtiy
@DenysPlakhtiy
Python and c# developer
Скорее всего у тебя бесплатная версия хостинга, а на ней стоят ограничения.
Источник: https://www.pythonanywhere.com/forums/topic/28845/
Ответ написан
Комментировать
Ваш ответ на вопрос

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

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