skip to Main Content
Traceback (most recent call last):
  File "/home/informer-master1/app/bot.py", line 42, in <module>
    informer = TGInformer(
  File "/home/informer-master1/app/informer.py", line 145, in __init__
    self.loop.run_until_complete(self.bot_interval())
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/informer-master1/app/informer.py", line 643, in bot_interval
    self.client = TelegramClient(session_file, self.account.account_api_id, self.account.account_api_hash)
  File "/usr/local/lib/python3.10/dist-packages/telethon/client/telegrambaseclient.py", line 262, in __init__
    session = SQLiteSession(session)
  File "/usr/local/lib/python3.10/dist-packages/telethon/sessions/sqlite.py", line 47, in __init__
    c = self._cursor()
  File "/usr/local/lib/python3.10/dist-packages/telethon/sessions/sqlite.py", line 228, in _cursor
    self._conn = sqlite3.connect(self.filename,
sqlite3.OperationalError: unable to open database file

i do not know how to solve this.i just print the session :

The printout looks like this:

session/my phone number

2

Answers


  1. Chosen as BEST ANSWER
    INFO:telethon.network.mtprotosender:Connecting to xxx.xxx.xxx.xx:443/TcpFull...
    WARNING:telethon.network.mtprotosender:Attempt 1 at connecting failed: TimeoutError: 
    WARNING:telethon.network.mtprotosender:Attempt 2 at connecting failed: TimeoutError: 
    WARNING:telethon.network.mtprotosender:Attempt 3 at connecting failed: TimeoutError: 
    WARNING:telethon.network.mtprotosender:Attempt 4 at connecting failed: TimeoutError: 
    WARNING:telethon.network.mtprotosender:Attempt 5 at connecting failed: TimeoutError: 
    WARNING:telethon.network.mtprotosender:Attempt 6 at connecting failed: TimeoutError: 
    Traceback (most recent call last):
      File "/home/informer-master1/app/bot.py", line 42, in <module>
        informer = TGInformer(
      File "/home/informer-master1/app/informer.py", line 145, in __init__
        self.loop.run_until_complete(self.bot_interval())
      File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
        return future.result()
      File "/home/informer-master1/app/informer.py", line 649, in bot_interval
        await self.client.start(phone=f'{self.account.account_phone}')
      File "/usr/local/lib/python3.10/dist-packages/telethon/client/auth.py", line 140, in _start
        await self.connect()
      File "/usr/local/lib/python3.10/dist-packages/telethon/client/telegrambaseclient.py", line 513, in connect
        if not await self._sender.connect(self._connection(
      File "/usr/local/lib/python3.10/dist-packages/telethon/network/mtprotosender.py", line 127, in connect
        await self._connect()
      File "/usr/local/lib/python3.10/dist-packages/telethon/network/mtprotosender.py", line 253, in _connect
        raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
    ConnectionError: Connection to Telegram failed 5 time(s)
    

    I created the session folder, using mkdir session, but a new problem appeared


  2. The link problem above is due to a network problem, which I solved with this solution

    Because I am running in ubuntu virtual machine, and the network card is my vmnet8 nat, and I have a firewall, so I configured a manual proxy inside the ubuntu virtual machine to link to my host’s v2rayn proxy. The ip of my proxy is my vmnet8 host address, and the port is the new v2rayn socks proxy port, which is 10808.
    my vmnet8 ip

    my v2rayn socks port

    import socks
    proxy = (socks.SOCKS5, 'your socks proxy IP (write a string here)', 'your socks proxy port (write an integer here, not a string)')
    TelegramClient(proxy=proxy, 'add other required arguments')
    

    if no module name socks

    pip install PySocks
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search