Forums

I can't run pyrogram

.

File "/home/EmiliaZero/.local/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
        is_authorized = await self.connect()
      File "/home/EmiliaZero/.local/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 40, in connect
        await self.load_session()
      File "/home/EmiliaZero/.local/lib/python3.10/site-packages/pyrogram/client.py", line 608, in load_session
        await self.storage.open()
      File "/home/EmiliaZero/.local/lib/python3.10/site-packages/pyrogram/storage/file_storage.py", line 58, in open
        self.conn = sqlite3.connect(str(path), timeout=1, check_same_thread=False)
    sqlite3.OperationalError: unable to open database file

This is my error. Everything worked on my computer. I already know, that the cause is that my database is in different place then it was on my PC. But i don't know how to move it to the right place. I istalled pyrogram through pip3 install --user pyrogram Does someone know how i can solve this

If you know where the database is on your PA account, just provide the full path in the code.

Sorry, I don't know where my database is:( And where to ente the path. When i worked with it on my pc i didn't need this information.

Sorry, I misread the error message from your first post. According to the pyrogram docs the database should be saved in a file my_account.session (when your account name is "my_account") -- it's not clear though where it saves it. I'd assume that would be in the directory where you run your script or where the script is stored. Did you check there? You could also look at the file structure on your local machine and see if you could find the database there.

It should open session in the same folder where script is( it worked like that on my PC), or create new, if session not found. And i can't understand why it doesn't make new database, but shows an error. I even imported session from my pc into location of the cloud script, but it doesn't work either

I see there's a bit related to authorization -- is it possible it failes on that part?

Yes, it failed on the Connection to account. it should create or open .session file in the location where exists when starting and login with it to telegram. Program crashes exactly in this moment

Where is it looking for that database file? It could be relative path that happened to work on your local machine but the current directory is different on PythonAnywhere.

I now solved this problem I added os.getcwd() into location of the session. But i got another error with connecting Then, looked into some forums and looks like PythonAnywhere doesn't work with this library. So it's impossible to run my bot here. Thanks for your time.

Thanks for letting us know!

The problem is that pyrogram library works just fine on everyone's machine but is not working properly on your consoles.

Only paid customers can complain on this as free users can't even install this library.

It doesn't require any configuration on local machine. It create two session files. and access it.

As you see above other user are able to run it.