OperationalError: (sqlite3.OperationalError) unable to open database file

Problem:

SQLite3 is being used in the application. The database file name entered in the application would have been entered with full path to the database file.  The database file may be writable by Apache/Tornado or whatever web server used for the application, but you still get the above error.

There may be other issues that could contribute for this problem. Here is an one such scenario that caused this problem and lead me to find this solution.

Scenario:

In my scenario, I have used SQLite3 for a web based application that is built using Flask and the application is powered by Tornado WSGI Server. This problem doesn't occur, when the same application powered using Flask built-in web server, but the problem would occur only when the application started with non built-in web server.

Solution:

Make sure the web server can also have write permission to the parent directory of the database file.


Post a Comment

2 Comments

  1. This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing...
    Selenium Training in Chennai|Selenium Training

    ReplyDelete
  2. Nice info, I am very thankful to you for sharing this important knowledge. This information is helpful for everyone. Read more info about Student Data Sample. So please always share this kind of information. Thanks.

    ReplyDelete