malformed database schema - or - No module named 'requests'

Post any problems / bugs / issues that are Mylar-related in here.
Post Reply
MaRzE
Posts: 8
Joined: Thu Feb 25, 2021 8:11 am

malformed database schema - or - No module named 'requests'

Post by MaRzE »

Hi all,
I am a little stuck with getting mylar3 to run. It was running fine until a few days ago.
I have tried restoring a backup of the db and no joy.
Running on macOS Catalina 10.15.7
Build branch python3-dev

Tail of the log is here:
23-Jun-2022 18:49:11 - INFO :: mylar.initialize.326 : MainThread : [IMPRINT_LOADS] Publisher imprint listing found, but possibly stale ( > 24hrs). Retrieving up-to-date listing
23-Jun-2022 18:49:11 - INFO :: mylar.initialize.355 : MainThread : [IMPRINT_LOADS] Successfully loaded imprints for 6 publishers
23-Jun-2022 18:49:11 - INFO :: mylar.initialize.357 : MainThread : Remapping the sorting to allow for new additions.
23-Jun-2022 18:49:11 - ERROR :: mylar.fetch.105 : MainThread : Fatal error executing query: malformed database schema (Batman)
23-Jun-2022 18:49:11 - ERROR :: mylar.excepthook.315 : MainThread : Uncaught exception: Traceback (most recent call last):
File "/Applications/Mylar/mylar.py", line 496, in <module>
main()
File "/Applications/Mylar/mylar.py", line 279, in main
mylar.initialize(mylar.CONFIG_FILE)
File "/Applications/Mylar/mylar/__init__.py", line 358, in initialize
COMICSORT = helpers.ComicSort(sequence='startup')
File "/Applications/Mylar/mylar/helpers.py", line 727, in ComicSort
comicsort = myDB.select("SELECT * FROM comics ORDER BY ComicSortName COLLATE NOCASE")
File "/Applications/Mylar/mylar/db.py", line 148, in select
sqlResults = self.fetch(query, args).fetchall()
File "/Applications/Mylar/mylar/db.py", line 89, in fetch
sqlResult = cursor.execute(query)
sqlite3.DatabaseError: malformed database schema (Batman)

When I execute the start up command:
python3 /Applications/Mylar/Mylar.py -d

get the following:
Traceback (most recent call last):
File "/Applications/Mylar/Mylar.py", line 27, in <module>
import mylar
File "/Applications/Mylar/mylar/__init__.py", line 27, in <module>
import requests
ModuleNotFoundError: No module named 'requests'


I am on this version after resetting mylar:
git reset --hard origin/python3-dev
HEAD is now at 0e3af985 Add Cross Origin Header to API fetchData so Chrome and Firefox extensions can make GET requests.
git pull
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), done.
From https://github.com/mylar3/mylar3
9ec6b1c7..5eaffc45 master -> origin/master
* [new tag] v0.5.4 -> v0.5.4
* [new tag] v0.5.5 -> v0.5.5
* [new tag] v0.5.6 -> v0.5.6
* [new tag] v0.5.7 -> v0.5.7
* [new tag] v0.5.8 -> v0.5.8
* [new tag] v0.5.9 -> v0.5.9
* [new tag] v0.5.9.5 -> v0.5.9.5
* [new tag] v0.6.0 -> v0.6.0
* [new tag] v0.6.1 -> v0.6.1
* [new tag] v0.6.2 -> v0.6.2
* [new tag] v0.6.3 -> v0.6.3
* [new tag] v0.6.4 -> v0.6.4
* [new tag] v0.6.5 -> v0.6.5
* [new tag] v0.6.5.1 -> v0.6.5.1
* [new tag] v0.6.5.2 -> v0.6.5.2
* [new tag] v0.6.6 -> v0.6.6
* [new tag] v0.6.7 -> v0.6.7
* [new tag] v0.6.8 -> v0.6.8
Already up to date.


Any ideas on how to get mylar back and running without trashing the database and starting again?

Thanks.
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: malformed database schema - or - No module named 'requests'

Post by evilhero »

Malformed db is pretty much done I think - you might be able to recover it using some sqlite commands from within the sqlite console - but offhand I don't know the commands to do that. If you have a backup of the db, you might want to try and restore it.

The no requests error is due to running a version of python that you did not run the requirements.txt against. Odds are your daemon starts up a different version of python vs the one you're hitting when you issue the python3 command by itself.

Mylar also has a backup feature that you can enable via either the CLI or config.ini. It will backup your config.ini or mylar.db (or both) on each startup and keep the last 5 versions in a rolling type of manner. Might not help now, but something to consider using going forward which might help with any future db corruption problems.
Post Reply