-
Notifications
You must be signed in to change notification settings - Fork 3
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 #11
Comments
Can you log the value of |
Sure, but unfortunately I'm not familiar with databases, yet. Could you please tell me how to do it? |
No need for database knowledge, it's just a Python thing. Edit the file |
Here's the output after adding the
|
Any idea what's causing this error and how to fix it? |
Does the file And do you have write access, i.e. if you put sth like this near the
|
Yes, and it's about 18 MB in size.
Yes, I can open it with SQLite Browser.
Also yes, it creates |
Is digiKam closed when you try this? (Perhaps the file is "locked" when opened in another application.) |
For these versions I'm getting Python 3.10.4, sqlite3 2.6.0 and sqlite_version 3.37.2. Are those significantly different for you? |
If you open a Python shell, can you use a simple tutorial to create a new database file with some dummy content? Just trying to see if the |
Yes.
Only the Python version:
Yes. I followed the tutorial and had no issues. |
Sounds interesting, but I'm not sure what to do. Should I add the highlighted lines to |
The former. It should result in sth like:
|
Okay, here's what I get after making the aforementioned changes:
|
Did you do this part? |
Oops, I forgot that. Going to upgrade it and try again... |
Which Python version should I upgrade to? I downloaded and installed Python 3.11.0rc1. Now I'm getting the following error:
And I'm having problems with
|
What about EDIT: Yes it seems like those wheels don't exist yet: giampaolo/psutil#2089 Unfortunately this means you'd first have to install Visual Studio. The instructions seem a little outdated. I'd follow these instructions (read the top portion of that page too) and if it keeps wanting to use |
Okay, so I uninstalled Python and then installed Build Tools for Visual Studio 2019, and after that I installed Python 3.11.0rc1.
But ironically, I was able to install psutil-5.9.1 using
|
Awesome!
Yes, we do mean |
Updated the code and still doesn't work:
Really makes me wonder why it can't open it. |
Well, the above steps were intended to get a more detailed error message, namely the Which environment do you run this in? Windows command prompt? Windows Terminal app? PowerShell? MinGW? WSL? I suspect that |
I'm assuming you're passing Can you change the aforementioned connect() code line to one of these variants (try one at a time):
|
Let's also do another sanity check on the value of
It should create |
I'm running it in Windows Terminal, which gives the same output as CMD.
Which is the same error if I run the command with single quotation marks and backward slashes in Powershell:
My digiKam database file and photos are on an external HDD. Is this a problem?
I tried all of them and nothing changed.
If this is what you mean:
it gives the following output and error message:
And no |
That error message is much "better" than the one you previously got from
Then I suspect that previously a broken path was fed to the program, e.g. sth like Does this mean that we should update the example command in the readme because apparently it doesn't work right with cmd / Windows Terminal? |
Nevermind that, I overlooked that |
Good question. Is the HDD connected at this time? |
Not sure. Maybe it's better to implement it in the code that would automatically do this double backslashes and double quotations if being run on Windows CMD/Terminal.
Yes. I always make sure about that.
Okay, moving on. Should I close this thread? |
That's not possible. The terminal (or rather the shell) is the program that interprets the user's input and transforms it to the string that is sent to the Python program. At this point, the broken characters like |
Does everything work if you simply use forward slashes instead of back slashes? (Only Which of the following outputs the correct path (with a single
|
So that the user can more easily spot typos and shell escaping mistakes (see #11).
You could also try this patch with your original attempt (with the single back slash) to see if it results in a more useful error message this time. (I'm hoping that future users of this script won't have to spend this much time and effort just to find out about backslash escaping.) |
You mean something like
All of them show the exact thing in front of |
Then I think something like how programs like
With paths like
|
Tried this on my own Windows now, after it installed years worth of updates ... Turns out that single quotes aren't special to cmd at all, so it just passes them through and thus they become part of the path. But a path starting with Double quotes work, but the double slash (i.e. a supposedly escaped slash) isn't correct then, because |
I'm getting the following error after trying to execute a dry run:
How to fix it?
Additional info: Running on Windows 10
The text was updated successfully, but these errors were encountered: