bitdruid / python-wayback-machine-downloader

Query and download archive.org as simple as possible.
MIT License
34 stars 2 forks source link

[BUG] database is locked - when writing to external storage #26

Open Tiptop4792 opened 2 weeks ago

Tiptop4792 commented 2 weeks ago

Hey! Thanks for the previous fix! Sorry to bother again ...

The previous fix works when files are written to local storage.

I just wanted to start a larger download and save it to an external storage via the -o operator. It worked with previous versions, however now, it reads:


!-- Exception: UNCAUGHT EXCEPTION !-- File: waybackdownloaderEnvironment/lib/python3.10/site-packages/pywaybackup/db.py !-- Function: init !-- Line: 39 !-- Segment: db.cursor.execute(cls.waybackup_table) !-- Description: database is locked

I'm on waybackup 2.0.3 running Ubuntu 22.04 and Python 3.10.12

Any idea what's causing this?

Many thanks!

Tiptop4792 commented 2 weeks ago

Some more info from the error log


Version: 2.0.3

Command: -u example.com -f --start 20130101 --end 20181231 -o /home/xyz/Documents/data/wayback-site/ --retry 1 --workers 6 --keep --progress

2024-11-12 14:01:44

!-- Exception: UNCAUGHT EXCEPTION !-- File: waybackdownloaderEnvironment/lib/python3.10/site-packages/pywaybackup/db.py !-- Function: init !-- Line: 39 !-- Segment: db.cursor.execute(cls.waybackup_table) !-- Description: database is locked

!-- Local Variables: -- cls = <class 'pywaybackup.db.Database'> -- dbfile = ../../Documents/data/wayback-site/waybackup_example.com.db -- query_identifier = example.com{'current': False, 'full': True, 'save': False}{'explicit': False, 'range': None, 'start': 20130101, 'end': 20181231, 'filetype': None, 'limit': None} -- db = <pywaybackup.db.Database object at 0x79f6da163520>

Traceback (most recent call last): File "waybackdownloaderEnvironment/bin/waybackup", line 8, in sys.exit(main()) File "waybackdownloaderEnvironment/lib/python3.10/site-packages/pywaybackup/main.py", line 19, in main db.init(config.dbfile, config.query_identifier) File "waybackdownloaderEnvironment/lib/python3.10/site-packages/pywaybackup/db.py", line 39, in init db.cursor.execute(cls.waybackup_table) sqlite3.OperationalError: database is locked

bitdruid commented 2 weeks ago

your external storage is a hdd / pendrive ? with a regular mountpoint for example like mount /dev/sda /mnt/storage ? just asking so i can reproduce :)

edit: my first thought is a permission problem. have you tried as root?

Tiptop4792 commented 2 weeks ago

Thanks for looking into this. It's cloud based, but yeah, it's mounted at /mounts/data and then symlinked.

When running with sudo the error message reads

sudo: waybackup: command not found

I thought about permissions, too. However, the same dir path worked with previous versions of the tool, when there wasn't a DB.

bitdruid commented 1 week ago

did some tests now. do you install the tool via virtual-env or --break-system-packages? tried it with a mounted usb-storage and was not able to set up the database as standard user. but sudo did it.

if you want to use the tool via sudo you have to source into your virtual-env with sudo or otherwise do a pip install as root.

did the database exist before you started the tool (again)? if so, maybe there is a problem with remaining LOCKS after keyboard-interrupt or something similar...

Tiptop4792 commented 1 week ago

I install via virtual-env. Will try with sudo. Hopefully next week! Thanks so much for testing!

bitdruid commented 4 days ago

in addition please briefly describe your connected cloud storage. what kind? mountpoint? permissions? (ls -la) was it a new run without an already existing db?