Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3.OperationalError: unable to open database file #417

Closed
HuarongLily opened this issue Sep 10, 2019 · 6 comments
Closed

sqlite3.OperationalError: unable to open database file #417

HuarongLily opened this issue Sep 10, 2019 · 6 comments

Comments

@HuarongLily
Copy link

[2/24] https://exhentai.org/g//
[gallery-dl][debug] Starting DownloadJob for 'https://exhentai.org/g/1468465/3c0f6cc499/'
[exhentai][debug] Using ExhentaiGalleryExtractor for 'https://exhentai.org/g/1468465/3c0f6cc499/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): e-hentai.org:443
[urllib3.connectionpool][debug] https://e-hentai.org:443 "GET /home.php HTTP/1.1" 200 2431
[exhentai][debug] Image Limits: 476/5000
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): exhentai.org:443
[urllib3.connectionpool][debug] https://exhentai.org:443 "GET /g/1468465/3c0f6cc499/ HTTP/1.1" 200 4763
[urllib3.connectionpool][debug] https://exhentai.org:443 "GET /s/5ccc288a53/1468465-1/1468465-1 HTTP/1.1" 200 1417
[exhentai][error] An unexpected error occurred: OperationalError - unable to open database file. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[exhentai][debug]
Traceback (most recent call last):
File "c:\users\emily\appdata\local\programs\python\python37\lib\site-packages\gallery_dl-1.10.2.dev0-py3.7.egg\gallery_dl\job.py", line 48, in run
self.dispatch(msg)
File "c:\users\emily\appdata\local\programs\python\python37\lib\site-packages\gallery_dl-1.10.2.dev0-py3.7.egg\gallery_dl\job.py", line 97, in dispatch
self.handle_directory(msg[1])
File "c:\users\emily\appdata\local\programs\python\python37\lib\site-packages\gallery_dl-1.10.2.dev0-py3.7.egg\gallery_dl\job.py", line 251, in handle_directory
self.initialize(keywords)
File "c:\users\emily\appdata\local\programs\python\python37\lib\site-packages\gallery_dl-1.10.2.dev0-py3.7.egg\gallery_dl\job.py", line 335, in initialize
self.archive = util.DownloadArchive(path, self.extractor)
File "c:\users\emily\appdata\local\programs\python\python37\lib\site-packages\gallery_dl-1.10.2.dev0-py3.7.egg\gallery_dl\util.py", line 704, in init
con = sqlite3.connect(path)
sqlite3.OperationalError: unable to open database file

@mikf
Copy link
Owner

mikf commented Sep 10, 2019

The file you specified with --download-archive or the archive option can't be opened, most likely because the path to it doesn't exist.

The error shouldn't halt the whole program, and I will fix that, but you as a user are responsible for setting valid config options.

If you are still using https://pastebin.com/vXxkwLCt as a template for your config file, you might want to get rid of everything except the exhentai part, or at least update and remove options to fit your own system.

@HuarongLily
Copy link
Author

I'm not sure what exactly is wrong. Do you mean the sqlite3 file for archive isn't there?
This is the code in the config file:
"archive": "~/Desktop/gallery-dl-archive.sqlite3",

This is the path for my archive file.
C:\Users\emily\Desktop\gallery-dl-archive.sqlite3

@HuarongLily
Copy link
Author

HuarongLily commented Sep 11, 2019

I used pip to install the newest stable version on PyPl, but that didn't really help either, so I'm confused.

Here's the config file. I checked everything, but I couldn't find anything that could be the cause of an sqlite3 error, since the locations are both on my desktop and I haven't edited them.

Redacted

@mikf
Copy link
Owner

mikf commented Sep 11, 2019

I just booted up my Windows 7 machine and downloaded a few galleries with your config without any problems. No errors, nothing. It just worked, so I'm kind of confused as well.

Maybe your archive file somehow got "corrupted" and sqlite3 therefore refuses to open it? But this error should happen later in the code, so I doubt it.
Another possibility might be that another process holds an exclusive lock on your archive file and no other processes are allowed to open it.

I did some changes regarding those kinds of errors (9178b54), so you'll only get a warning and it will still download stuff, but it obviously won't be using your archive if that happens.

@mikf mikf changed the title Issue that asked me to paste with --verbose flag sqlite3.OperationalError: unable to open database file Sep 11, 2019
@HuarongLily
Copy link
Author

[exhentai][warning] Failed to open download archive at 'C:\Users\emily\AppData\Roaming\SPB_Data/Desktop/gallery-dl-archive.sqlite3' ('OperationalError: unable to open database file')

That's the warning I'm getting, but it otherwise works, I think.

I'm not very good with code, but is there any way to refresh or repair the archive.sqlite3 file so that it does work?

@mikf
Copy link
Owner

mikf commented Sep 11, 2019

Notice that it is trying to open
C:\Users\emily\AppData\Roaming\SPB_Data/Desktop/gallery-dl-archive.sqlite3
instead of
C:\Users\emily\Desktop\gallery-dl-archive.sqlite3

The tilde ~ at the start of all paths in your config file seems to get replaced with
C:\Users\emily\AppData\Roaming\SPB_Data instead of your actual home directory, most likely because your %HOME% environment variable got set to that specific path and now it gets used instead of the contents of %USERPROFILE%.

Try replacing all ~ in your config with %USERPROFILE% and it should start working again. You might also want to take a look at the contents of C:\Users\emily\AppData\Roaming\SPB_Data\Downloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants