New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite3.OperationalError: database is locked #294
Comments
Make sure bot is not running. If you're using Linux, make sure your work dir owner is your, if you logged in as user but workdir owner is root, it will not allow you to read database. If you're using windows, try update to python 3.7, because python3.6.0 have bug at this. Based on my experience |
Seems SQLite dose not support concurrent connection |
SQLite does support multiple concurrent connections, but Pyrogram doesn't do anything to allow this nicely, on purpose. The error is a nice-to-have in order to protect the database integrity. What do you need concurrent connections for? You should not mess with the session file in any way, it's only an internal detail needed to cache peers and persist the authorized key so that you don't have to login again when you restart the client. If you want to run multiple client instances using the same account, please read this: https://docs.pyrogram.org/faq#can-i-use-multiple-clients-at-once-on-the-same-account |
Thank you for your good support.
|
@shamloo Send the full traceback of the error and the full Python version ( |
|
@shamloo with your authorized session, call Tell me what happens. |
seems app.export_session_string() work for user mode , not bot login mode Code:
output: config.ini file also present:
|
@delivrance , Actually i want to use your library to complete my bot , due to lack of a method to delete other bots messages in Bot API. |
@delivrance |
It works, but you have to login first, then use the result from About this issue, I've added a new FAQ: https://docs.pyrogram.org/dev/faq#sqlite3-operationalerror-database-is-locked |
i logged in and then using memory method , its shown on sample code. |
@shamloo This place is not intended for questions, but for issues with the library. Please join our community and ask there instead: https://t.me/pyrogram |
first find running python3 process ==========
|
This is because when you press ctrl + Z (or an error occurs) the script is disabled "aggressively" (or killed) and therefore the data exchanged by the script with the database is terminated. To avoid this, the script must be disabled with Ctrl + C. p.s. I hope the translation is correct |
For anyone facing the same issue 3 years later... just make sure you're using "with" statement with any client operations:
|
Great Library.
I am using it and its ok.
in many times i get " sqlite3.OperationalError: database is locked " errors and it stops working.
in there any way to solve this?
The text was updated successfully, but these errors were encountered: