【问题标题】:Operational Error : unable to open database file (automation)操作错误:无法打开数据库文件(自动化)
【发布时间】:2021-08-17 16:28:43
【问题描述】:

我不知道我做错了什么,请帮我解决这个问题... 我正在尝试构建一个电报机器人,并在许多 github 研究的帮助下,我想出了这段代码。但是我遇到了这个错误,请帮助解决它。

from telethon import TelegramClient, connection
import logging
from telethon import sync, TelegramClient, events
import json

with open('config.json', 'r') as f:
    config = json.loads(f.read())

logging.basicConfig(level=logging.WARNING)

accounts = config['accounts']

folder_session = 'session/'

for account in accounts:
    api_id = account['api_id']
    api_hash = account['api_hash']
    phone = account['phone']
    print(phone)

    client = TelegramClient(folder_session + phone, api_id, api_hash)
    client.start()
    if client.is_user_authorized():
        print('Login success')
    else:
        print('Login fail')
    client.disconnect()

_________________________________________________________________________________________________*
 

 OperationalError                          Traceback (most recent call last)
<ipython-input-3-dd3766aaae79> in <module>
     19         print(phone)
     20 
---> 21         client = TelegramClient(folder_session + phone, api_id, api_hash)
     22         client.start()
     23         if client.is_user_authorized():

【问题讨论】:

    标签: python automation window project operationalerror


    【解决方案1】:

    您只需在该 Python 文件的同一目录中创建一个名为 session 的文件夹。

    【讨论】:

      猜你喜欢
      • 2014-09-26
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 2013-01-03
      • 1970-01-01
      • 2015-10-18
      • 1970-01-01
      • 2011-05-01
      相关资源
      最近更新 更多