Взял готовый код из docks opentele, и столкнулся с неизвестной мне ошибкой
Мой код:
from opentele.td import TDesktop
from opentele.tl import TelegramClient
from opentele.api import API, UseCurrentSession
import asyncio
async def main():
# Load TDesktop client from tdata folder
tdataFolder = r"F:\pythonProject\malling_bot_payment\tdata"
tdesk = TDesktop(tdataFolder)
# Check if we have loaded any accounts
assert tdesk.isLoaded()
# flag=UseCurrentSession
#
# Convert TDesktop to Telethon using the current session.
client = await tdesk.ToTelethon(session="telethon.session", flag=UseCurrentSession)
# Connect and print all logged-in sessions of this client.
# Telethon will save the session to telethon.session on creation.
await client.connect()
await client.PrintSessions()
asyncio.run(main())
Ошибка:
Traceback (most recent call last):
File "F:\pythonProject\malling_bot_payment\main.py", line 25, in <module>
asyncio.run(main())
File "C:\Users\Артём\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Артём\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "F:\pythonProject\malling_bot_payment\main.py", line 10, in main
tdesk = TDesktop(tdataFolder)
File "F:\pythonProject\malling_bot_payment\venv\lib\site-packages\opentele\td\tdesktop.py", line 125, in __init__
self.LoadTData()
File "F:\pythonProject\malling_bot_payment\venv\lib\site-packages\opentele\td\tdesktop.py", line 194, in LoadTData
raise e
File "F:\pythonProject\malling_bot_payment\venv\lib\site-packages\opentele\td\tdesktop.py", line 185, in LoadTData
self.__loadFromTData()
File "F:\pythonProject\malling_bot_payment\venv\lib\site-packages\opentele\td\tdesktop.py", line 363, in __loadFromTData
Expects(len(self.accounts) > 0, "No account has been loaded")
File "F:\pythonProject\malling_bot_payment\venv\lib\site-packages\opentele\exception.py", line 284, in Expects
raise exception
File "F:\pythonProject\malling_bot_payment\venv\lib\site-packages\opentele\td\tdesktop.py", line 363, in __loadFromTData
Expects(len(self.accounts) > 0, "No account has been loaded")
opentele.exception.OpenTeleException: Unexpected Exception: No account has been loaded [ Called by BaseObject.TDesktop.__loadFromTData() ]