thedemons / opentele

A Python Telegram API Library for converting between tdata and telethon sessions, with built-in official Telegram APIs.
https://opentele.readthedocs.io/
MIT License
306 stars 99 forks source link

Errors at loop, need help. #61

Open ghost opened 2 years ago

ghost commented 2 years ago

hello mate, i very like your repo but i have problem with opentele.

i want create many session file from tdata folders

async def main():
    _path = input("[Path]> ")
    all_dirs = glob.glob(f"{_path}/*/Telegram/*/")
    print(len(all_dirs))
    for tdataFolder in all_dirs:
        try:
            time.sleep(2)
            tdesk = TDesktop(tdataFolder)
            api = API.TelegramIOS.Generate()
            savePath = r"tgses\\" + str(int(time.time())) + ".session"
            client = await tdesk.ToTelethon(savePath, CreateNewSession, api)
            await client.connect()
            await client.PrintSessions()
            await client.disconnect()
        except TDesktopUnauthorized:
            print("TDesktopUnauthorized | TDesktop client is unauthorized")
            continue
        except OpenTeleException:
            print("OpenTeleException | No account has been loaded")
            continue
        except LoginFlagInvalid:
            print("LoginFlagInvalid | LoginFlag invalid")
            continue
        except Exception as ex:
            print(ex)
            continue
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())

i used try except , and have this error:


File "C:\Users\Plutonium\Desktop\tdata.py", line 51, in main
client = await tdesk.ToTelethon(savePath, CreateNewSession, api)

telethon.errors.common.InvalidBufferError: Invalid response buffer (HTTP code 404)

Future exception was never retrieved future: <Future finished exception=InvalidBufferError('Invalid response buffer (HTTP code 404)')>



> And this error:

`maximum recursion depth exceeded in comparison`

how fix it ? pls help me.
Ch4ttY commented 2 years ago

The same issue, everything was good with one account at tdata if more than get 'maximum recursion depth exceeded'

faredus commented 2 years ago

did anybody figure out how to do this? i get maxium recursion depth exceeded all the time