使用 PyCharm 2023.2.5、Python 3.11.1 和以下代码
from telethon import TelegramClient, sync, events
class telegram_messenger:
def __init__(self):
api_id = '123'
api_hash = 'ABC'
bot_token = 'ZZZ'
client = TelegramClient('bot', api_id, api_hash).start(bot_token=bot_token)
我收到回复了
Process finished with exit code -1073741819 (0xC0000005)
。如果我取消注释行 client = ...
,代码运行得很好。这是怎么回事?
正如用户 Lonami 在评论中指出的那样,我的 Python 版本似乎存在缺陷。重新安装(和升级)Python 和 Telethon 解决了这个问题。谢谢你,洛娜米!