idlesign / torrt

Automates torrent updates for you
https://github.com/idlesign/torrt
BSD 3-Clause "New" or "Revised" License
112 stars 19 forks source link

[TelegramBot] not working on latest Python 3.10.2 #74

Closed NecroKote closed 2 years ago

NecroKote commented 2 years ago

Fresh install of torrt (v1.0.0): pip install --user torrt[telegram]

torrt run_bots prints the following to log:

python3.10/site-packages/telegram/utils/request.py:40: UserWarning: python-telegram-bot wasn't properly installed. Please refer to README.rst on how to properly install.
warnings.warn("python-telegram-bot wasn't properly installed. Please refer to README.rst on "
ERROR: TelegramBot: You have not installed python-telegram-bot library.

Initial investigation showed, that torrt have it's dependency on telegram-bot-library hardwired as: python-telegram-bot >=11.1.0, <12.0.0a0 with currently resolves to python-telegram-bot==11.1.0

inside the mentioned library is the following:

...
try:
    import telegram.vendor.ptb_urllib3.urllib3 as urllib3
    import telegram.vendor.ptb_urllib3.urllib3.contrib.appengine as appengine
    from telegram.vendor.ptb_urllib3.urllib3.connection import HTTPConnection
    from telegram.vendor.ptb_urllib3.urllib3.fields import RequestField
    from telegram.vendor.ptb_urllib3.urllib3.util.timeout import Timeout
except ImportError:
  try:
  ...
  except ImportError:
          warnings.warn(
              "python-telegram-bot wasn't properly installed. Please refer to README.rst on "
              "how to properly install."
          )
...

Trying even the first import by hand (import telegram.vendor.ptb_urllib3.urllib3 as urllib3) causes this:

  File "python3.10/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/selectors.py", line 11, in <module>
    from collections import namedtuple, Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

So, it seems like it's the perfect time to update torrt's dependency.

PS: I'll look into this. Just creating this issue to keep track of it.