Read Firefox sqlite files with Python
Sayth Renshaw
flebber.crue at gmail.com
Sat Nov 4 20:13:28 EDT 2017
On Sunday, 5 November 2017 04:32:26 UTC+11, Steve D'Aprano wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
>
>
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line + '\n')
>
>
> The error I get is:
>
> Traceback (most recent call last):
> File "<stdin>", line 2, in <module>
> File "/usr/local/lib/python3.5/sqlite3/dump.py", line 30, in _iterdump
> schema_res = cu.execute(q)
> sqlite3.DatabaseError: file is encrypted or is not a database
>
>
> If I open the file in a hex editor, it starts with:
>
> SQLite format 3
>
> and although I can see a few human readable words, the bulk of the file looks
> like noise.
>
>
>
>
> --
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
https://stackoverflow.com/a/18601429
Version mismatch between sqlite CLI and python sqlite API? I created again my db from the script instead of the CLI. Now insert and select work from the script, but not from the CLI. $sqlite -version returns 2.8.17, while the python version is 2.7.3.
Sayth
More information about the Python-list
mailing list