我尝试从telethon运行基本命令以连接到Telegram,而我却遇到两个错误:
从未等待过'AuthMethods._start' RuntimeWarning:启用tracemalloc以获取对象分配回溯并且DATABASE已锁定
from telethon import TelegramClient, sync
from telethon.tl.functions.messages import GetHistoryRequest
from telethon.errors.rpcerrorlist import RpcMcgetFailError
api_id = xxxxxx
api_hash = 'xxxxxxxxxxxx'
phone_number = '+393333941671'
sesssion_name = 'scraper'
client = TelegramClient(sesssion_name,
api_id,
api_hash)
client = TelegramClient('session_name', api_id, api_hash).start()
错误
__main__:9: RuntimeWarning: coroutine 'AuthMethods._start' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "<ipython-input-19-21e0fd5ffefd>", line 11, in <module>
client = TelegramClient('session_name', api_id, api_hash).start()
File "C:\Users\Anca\Anaconda3\Lib\site-packages\telethon\client\telegrambaseclient.py", line 236, in __init__
DEFAULT_PORT
File "C:\Users\Anca\Anaconda3\Lib\site-packages\telethon\sessions\sqlite.py", line 157, in set_dc
self._update_session_table()
File "C:\Users\Anca\Anaconda3\Lib\site-packages\telethon\sessions\sqlite.py", line 183, in _update_session_table
c.execute('delete from sessions')
OperationalError: database is locked