I received a sqlite file that I need to read with Python.
I am able to open the file with the application "DB Browser for SQLite". I can see the table structure and execute select statements within that application. So the file seem OK. (I did not create it and do not know how it was created.)
However, when I try to read it from Python I get an error:
sqlite3.DatabaseError: file is encrypted or is not a database
import sqlite3 as lite
sqlite3.sqlite_version
# '3.6.21'
con = lite.connect('path\file.sqlite')
cur = con.cursor()
cur.execute('SELECT * from mytable')
# sqlite3.DatabaseError: file is encrypted or is not a database
If I open the file with a text editor then the first words are "SQLite format 3" followed by unreadable text. So it was generated with version 3? Not sure if it needs to be converted to a db file?
I'm not sure where to go from here.
\fis the control character for form feed. Reference: en.wikipedia.org/wiki/Control_character#In_ASCII You can use raw strings or better yet useos.path.join.