Closed mengyyy closed 5 years ago
What patch of Python 3.5 are you using? (e.g., Python 3.5.1, etc.)
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
and from telethon import TelegramClient, events, sync
has the same problem
>>> from telethon import TelegramClient, events, sync
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/telethon/__init__.py", line 1, in <module>
from .client.telegramclient import TelegramClient
File "/usr/local/lib/python3.5/dist-packages/telethon/client/__init__.py", line 13, in <module>
from .users import UserMethods # Required for everything
File "/usr/local/lib/python3.5/dist-packages/telethon/client/users.py", line 7, in <module>
from .. import errors, utils, hints
File "/usr/local/lib/python3.5/dist-packages/telethon/hints.py", line 54, in <module>
io.IOBase
File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/usr/lib/python3.5/typing.py", line 512, in __new__
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__
if super().__subclasscheck__(cls):
File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__
for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
Unfortunately I cannot install Python 3.5.2 on my system (tried both manually and with pyenv
), because it requires such an old OpenSSL version that is no longer easily available :(
This was apparently reported at https://github.com/python/typing/issues/266 and fixed by https://github.com/python/typing/pull/267 so I'll see what I can do about it.
This might actually just be a better fix altogether, instead of some hacky workaround. Also, consider upgrading. 3.5.2 is ancient and you're missing all the good stuff.
Thank you i have changed to python 3.7.3
Could you test 3.5.2 just to see if it got fixed anyway? After that, you can use 3.7.3 all you want.
Just tried to run telethon on python 3.5.2. it doesn't seem like the fix worked
Traceback (most recent call last):
File "/mnt/d/Dev/WTT-Bridge/run.py", line 5, in <module>
import src.telegram_selfbot as tgs
File "/mnt/d/Dev/WTT-Bridge/src/telegram_selfbot.py", line 1, in <module>
from telethon.sync import TelegramClient
File "/home/Boro/.local/lib/python3.5/site-packages/telethon/__init__.py", line 1, in <module>
from .client.telegramclient import TelegramClient
File "/home/Boro/.local/lib/python3.5/site-packages/telethon/client/__init__.py", line 13, in <module>
from .users import UserMethods # Required for everything
File "/home/Boro/.local/lib/python3.5/site-packages/telethon/client/users.py", line 7, in <module>
from .. import errors, utils, hints
File "/home/Boro/.local/lib/python3.5/site-packages/telethon/hints.py", line 56, in <module>
typing.BinaryIO
File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/usr/lib/python3.5/typing.py", line 512, in __new__
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__
if super().__subclasscheck__(cls):
File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__
for scls in cls.__subclasses__():
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
Did you install from GitHub or from PyPi?
Did you install from GitHub or from PyPi?
from github with pip3 install -U https://github.com/LonamiWebs/Telethon/archive/master.zip --user
My traceback mentions typing.BinaryIO
instead of io.IOBase
like in @mengyyy s post
When i import DocumentAttributeFilename from telethon.tl.types i get
But i when i import it send time, this will not happen