0

SORRY FOR MY ENGLISH!))

Trying to launch telegram client on pythonanywhere hosting using flask

Loaded all necessary libraries (see photo1)

On this site created an api-application, got it app_id and api_hash

Further, I made a flask application with this code (for test)

@app.route('/')
def hello_world():
    #------------------------If an error occurred during import------------
    try:
        from telethon import TelegramClient, sync
    except Exception as e:
        return 'IMPORT ERROR: ' + str(e)
    #------------------------we catch it-----------------------------------

    api_id = API_ID_FROM_MY_TELEGRAM_ORG #Тут подставляю свое
    api_hash = API_HASH_CODE_FROM_MY_TELEGRAM_ORG #Тут подставляю свое

    #----------If an error occurred while creating the object--------------
    try:
        client = TelegramClient('test_session', api_id, api_hash)
        return 'Succes!'
    except Exception as e:
        return 'OBJECT ERROR: ' + str(e)
    #------------------------we catch it-----------------------------------

When you start and open the application in the browser, the following error is displayed (in text form):

OBJECT ERROR: database is locked

This text corresponds to the last try/catch construction, so an error occurs when trying to create an object client = TelegramClient('test_session', api_id, api_hash)

What is this exception and how in my case to fight it?

0 Answers0