Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No account has been loaded #79

Open
AleksFimin opened this issue Dec 13, 2022 · 14 comments
Open

No account has been loaded #79

AleksFimin opened this issue Dec 13, 2022 · 14 comments
Labels
bug Something isn't working

Comments

@AleksFimin
Copy link

AleksFimin commented Dec 13, 2022

Python version: 3.8.2
Pip version: 22.3.1
Operation System: Windows 10 (10.0.19044)

Tdata:
Снимок экрана 2022-12-13 233245

Code:

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"C:\Users\Alex\Downloads\15\79872317223\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())

Error:

Traceback (most recent call last):
  File "test.py", line 63, in <module>
    asyncio.run(main())
  File "C:\Program Files\Python38\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "test.py", line 48, in main
    tdesk = TDesktop(tdataFolder)
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 141, in __init__ 
    self.LoadTData()
PS D:\Code\Python\TgTool> py test.py
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    asyncio.run(main())
  File "C:\Program Files\Python38\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "test.py", line 10, in main
    tdesk = TDesktop(tdataFolder)
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 141, in __init__ 
    self.LoadTData()
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 216, in LoadTData
    raise e
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 203, in LoadTData
    self.__loadFromTData()
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 453, in __loadFromTData
    Expects(len(self.accounts) > 0, "No account has been loaded")
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\exception.py", line 326, in Expects
    raise exception
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 453, 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() ]
@AleksFimin AleksFimin added the bug Something isn't working label Dec 13, 2022
@Derivability
Copy link

Same issue here
Any updates on this?

@gloriusglo
Copy link

@AleksFimin, у меня получилось победить эту ошибку.

  1. https://github.com/thedemons/opentele/pull/74/files - пишут, что fix решает проблему, но я не стал его использовать. Удалил opentele и заново установил.
  2. В каталоге Tdata удалил все каталоги кроме D877F783D5D3EF8C, файлы все оставил.
  3. Из каталога D877F783D5D3EF8C удалил все, кроме файлов configs и maps.
  4. Скачал последнюю версию tportable с офсайта, открыл аккаунт в ней, вышел из программы.

После этого сессия создалась.

@empty-git
Copy link

Python version: 3.8.2 Pip version: 22.3.1 Operation System: Windows 10 (10.0.19044)

Tdata: Снимок экрана 2022-12-13 233245

Code:

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"C:\Users\Alex\Downloads\15\79872317223\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())

Error:

Traceback (most recent call last):
  File "test.py", line 63, in <module>
    asyncio.run(main())
  File "C:\Program Files\Python38\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "test.py", line 48, in main
    tdesk = TDesktop(tdataFolder)
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 141, in __init__ 
    self.LoadTData()
PS D:\Code\Python\TgTool> py test.py
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    asyncio.run(main())
  File "C:\Program Files\Python38\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "test.py", line 10, in main
    tdesk = TDesktop(tdataFolder)
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 141, in __init__ 
    self.LoadTData()
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 216, in LoadTData
    raise e
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 203, in LoadTData
    self.__loadFromTData()
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 453, in __loadFromTData
    Expects(len(self.accounts) > 0, "No account has been loaded")
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\exception.py", line 326, in Expects
    raise exception
  File "C:\Users\Alex\AppData\Roaming\Python\Python38\site-packages\opentele\td\tdesktop.py", line 453, 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() ]

Вам удалось найти фикс без костылей?

@SharkLabDev
Copy link

Same. How fix it? I tried as described above, but it didn’t work. There is a solution?

@Kosminis
Copy link

@AleksFimin, у меня получилось победить эту ошибку.

  1. https://github.com/thedemons/opentele/pull/74/files - пишут, что fix решает проблему, но я не стал его использовать. Удалил opentele и заново установил.
  2. В каталоге Tdata удалил все каталоги кроме D877F783D5D3EF8C, файлы все оставил.
  3. Из каталога D877F783D5D3EF8C удалил все, кроме файлов configs и maps.
  4. Скачал последнюю версию tportable с офсайта, открыл аккаунт в ней, вышел из программы.

После этого сессия создалась.

did not help. Any other solutions?

@RobertAzovski
Copy link

@AleksFimin, у меня получилось победить эту ошибку.

  1. https://github.com/thedemons/opentele/pull/74/files - пишут, что fix решает проблему, но я не стал его использовать. Удалил opentele и заново установил.
  2. В каталоге Tdata удалил все каталоги кроме D877F783D5D3EF8C, файлы все оставил.
  3. Из каталога D877F783D5D3EF8C удалил все, кроме файлов configs и maps.
  4. Скачал последнюю версию tportable с офсайта, открыл аккаунт в ней, вышел из программы.

После этого сессия создалась.

Didn't help with new tdatas

@no-comm
Copy link

no-comm commented May 31, 2024

as a temporary solution you can use the old version, I use tportable-x64.4.14.2, in it tdata is created exactly which is supported by the library

@VectorASD
Copy link

One reason may be that the teleopen is out of date. I have the last entry in my keycard for key type 25, which is probably 16 bytes long. If this entry is ignored, this error does not occur ;'-}
BugReport: #120

@KEKACIK
Copy link

KEKACIK commented Jul 6, 2024

Hello everyone, today I found a solution to this error. It occurs due to the fact that we are creating tdata from a new version of the telegram client, and the last update of the opentele library was 2 years ago.
SOLUTION
We go to the official git opentele (link below) and download the latest version, released 7 months ago and run it locally.
https://github.com/thedemons/opentele

Thank you all for your attention <3

@SamVitas1983
Copy link

Hello everyone, today I found a solution to this error. It occurs due to the fact that we are creating tdata from a new version of the telegram client, and the last update of the opentele library was 2 years ago. SOLUTION We go to the official git opentele (link below) and download the latest version, released 7 months ago and run it locally. https://github.com/thedemons/opentele

Thank you all for your attention <3

Works for me, great job bro!

@adist
Copy link

adist commented Jul 19, 2024

Hello everyone, today I found a solution to this error. It occurs due to the fact that we are creating tdata from a new version of the telegram client, and the last update of the opentele library was 2 years ago. SOLUTION We go to the official git opentele (link below) and download the latest version, released 7 months ago and run it locally. https://github.com/thedemons/opentele
Thank you all for your attention <3

Works for me, great job bro!

Hi Sam.. may i know which python version you use?

because i still got that error on Python 3.7, pip 24.0, on Windows 11..

@SamVitas1983
Copy link

Hello everyone, today I found a solution to this error. It occurs due to the fact that we are creating tdata from a new version of the telegram client, and the last update of the opentele library was 2 years ago. SOLUTION We go to the official git opentele (link below) and download the latest version, released 7 months ago and run it locally. https://github.com/thedemons/opentele
Thank you all for your attention <3

Works for me, great job bro!

Hi Sam.. may i know which python version you use?

because i still got that error on Python 3.7, pip 24.0, on Windows 11..

I'm using Python 3.11. Have you copy the latest SCR files into C:\Program Files\Python\Lib\site-packages\opentele ? Good luck

@v0ts3n
Copy link

v0ts3n commented Feb 5, 2025

Hello everyone, today I found a solution to this error. It occurs due to the fact that we are creating tdata from a new version of the telegram client, and the last update of the opentele library was 2 years ago. SOLUTION We go to the official git opentele (link below) and download the latest version, released 7 months ago and run it locally. https://github.com/thedemons/opentele

Thank you all for your attention <3

Works for me, thanks

@RobertAzovski
Copy link

yes. WHen you install via pip install -U opentele it somehow installs older version. So the solution to install using latest commit link explicitely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests