Telethon: OperationalError: database is locked

后端 未结 3 1748
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-16 18:13

Apologies if it is a silly question.

I am trying telethon for the first time and it fails to synchronize with my telegram API.

I get an IP address when I ty

3条回答
  •  孤城傲影
    2021-01-16 18:26

    You have 2 problems here, first problem is related to authentication i guess, i will talk about database lock problem :

    Session name that you have passed is already in use or active hence locked.

    It becomes session file name if you use string as a parameter like here you have passed "name", this is one way to create a session.

    other wise you can use telethon.sessions.abstract.Session object and pass it as parameter , this is second way.

    And third way, you can simply pass None.

    If it’s None, the session will not be saved, and you should call log_out() when you’re done.

    client =  TelegramClient(None, api_id, api_hash)
    

    Hope this helps.

提交回复
热议问题