KnugiHK / WhatsApp-Chat-Exporter

A customizable Android and iOS/iPadOS WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14, Crypt15, and new schema supported.
https://wts.knugi.dev/
MIT License
586 stars 85 forks source link

Error: sqlite3.DatabaseError: file is not a database #3

Closed formone98127 closed 3 years ago

formone98127 commented 3 years ago

Got this error with Android database:

Error messages:

one@ss3:~/Dropbox/working_wts$ wtsexporter -a
Everything is done!    

one@ss3:~/Dropbox/working_wts$ wtsexporter -a key -b msgstore.db.crypt14
Traceback (most recent call last):
  File "/home/one/.local/bin/wtsexporter", line 8, in <module>
    sys.exit(main())                                                                                      
  File "/home/one/.local/lib/python3.8/site-packages/Whatsapp_Chat_Exporter/__main__.py", line 120, in main
    messages(db, data)
  File "/home/one/.local/lib/python3.8/site-packages/Whatsapp_Chat_Exporter/extract.py", line 41, in messages
    c.execute("""SELECT count() FROM messages""")          
sqlite3.DatabaseError: file is not a database  
KnugiHK commented 3 years ago

You mean when you are working on an unencrypted Android WhatsApp database, the program works. However, when it comes to encrypted WhatsApp backup, it doesn't work?

formone98127 commented 3 years ago

Dunno if it is working on unencrypted database or encrypted wa backup. I just run the command and the error msg occoured

KnugiHK commented 3 years ago

What files do you have in the working directory and how you install the exporter?

formone98127 commented 3 years ago

the key file and the unencrypted wa backup file(msgstore.db.crypt14)

KnugiHK commented 3 years ago

Did you install the exporter with pip or install from source?

formone98127 commented 3 years ago

with pip

KnugiHK commented 3 years ago

You have the key file and the crypt14 file, so, I assume you are working on encrypted Android WhatsApp backup. If you want to work on this, you will have to git clone it and do python3 setup.py install, since feature of supporting encrypted Android WhatsApp backup is not yet released. In fact, I committed the feature into the wrong branch (i.e. main branch) lol, but never mind.

Also, the correct command for encrypted Android WhatsApp backup is

wtsexporter -a -k key -b msgstore.db.crypt14
formone98127 commented 3 years ago

thank you! Appreciate you work very much!

KnugiHK commented 3 years ago

So, its works now? Good to see it suit your needs!

formone98127 commented 3 years ago

tried to install it by setup.py:

one@ss3:~/Whatsapp-Chat-Exporter$ sudo python3 setup.py install running install running bdist_egg running egg_info writing whatsapp_chat_exporter.egg-info/PKG-INFO writing dependency_links to whatsapp_chat_exporter.egg-info/dependency_links.txt writing entry points to whatsapp_chat_exporter.egg-info/entry_points.txt writing requirements to whatsapp_chat_exporter.egg-info/requires.txt writing top-level names to whatsapp_chat_exporter.egg-info/top_level.txt reading manifest file 'whatsapp_chat_exporter.egg-info/SOURCES.txt' writing manifest file 'whatsapp_chat_exporter.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter copying build/lib/Whatsapp_Chat_Exporter/whatsapp.html -> build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter copying build/lib/Whatsapp_Chat_Exporter/init.py -> build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter copying build/lib/Whatsapp_Chat_Exporter/extract_iphone.py -> build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter copying build/lib/Whatsapp_Chat_Exporter/main.py -> build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter copying build/lib/Whatsapp_Chat_Exporter/extract_iphone_media.py -> build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter copying build/lib/Whatsapp_Chat_Exporter/extract.py -> build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter byte-compiling build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter/init.py to init.cpython-38.pyc byte-compiling build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter/extract_iphone.py to extract_iphone.cpython-38.pyc byte-compiling build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter/main.py to main.cpython-38.pyc byte-compiling build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter/extract_iphone_media.py to extract_iphone_media.cpython-38.pyc byte-compiling build/bdist.linux-x86_64/egg/Whatsapp_Chat_Exporter/extract.py to extract.cpython-38.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying whatsapp_chat_exporter.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying whatsapp_chat_exporter.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying whatsapp_chat_exporter.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying whatsapp_chat_exporter.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying whatsapp_chat_exporter.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying whatsapp_chat_exporter.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO zip_safe flag not set; analyzing archive contents... Whatsapp_Chat_Exporter.pycache.extract.cpython-38: module references file Whatsapp_Chat_Exporter.pycache.extract_iphone.cpython-38: module references file creating 'dist/whatsapp_chat_exporter-0.6-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing whatsapp_chat_exporter-0.6-py3.8.egg removing '/usr/local/lib/python3.8/dist-packages/whatsapp_chat_exporter-0.6-py3.8.egg' (and everything under it) creating /usr/local/lib/python3.8/dist-packages/whatsapp_chat_exporter-0.6-py3.8.egg Extracting whatsapp_chat_exporter-0.6-py3.8.egg to /usr/local/lib/python3.8/dist-packages whatsapp-chat-exporter 0.6 is already the active version in easy-install.pth Installing wtsexporter script to /usr/local/bin Installed /usr/local/lib/python3.8/dist-packages/whatsapp_chat_exporter-0.6-py3.8.egg Processing dependencies for whatsapp-chat-exporter==0.6 Searching for Jinja2==2.10.1 Best match: Jinja2 2.10.1 Adding Jinja2 2.10.1 to easy-install.pth file Using /usr/lib/python3/dist-packages Finished processing dependencies for whatsapp-chat-exporter==0.6

Seems it success however when i run wtsexporter -e, it said no such flie or directory:

one@ss3:~/Dropbox/working_wts$ wtsexporter -e
-bash: /home/one/.local/bin/wtsexporter: No such file or directory

formone98127 commented 3 years ago

also, when running wtsexporter -h, there is no option for -k:

one@ss3:~/Whatsapp-Chat-Exporter$ wtsexporter -h Usage: wtsexporter [options] Options:
--version show program's version number and exit
-h, --help show this help message and exit
-a, --android Define the target as Android
-i, --iphone Define the target as iPhone
-w WA, --wa=WA Path to contact database
-m MEDIA, --media=MEDIA
Path to WhatsApp media folder
-b BACKUP, --backup=BACKUP
Path to iPhone backup
-o OUTPUT, --output=OUTPUT
Output to specific directory
-j, --json Save the result to a single JSON file
-d DB, --db=DB Path to database file

KnugiHK commented 3 years ago

There is no option -e. And did you do a fresh git clone or git pull before installing? Option -k is present in the main branch since commit 18ee152.

Btw, you should put the output into a code block for readability.