davidlday / RemindersWidget

An Übersicht widget to display your pending Reminders tasks on the desktop.
MIT License
16 stars 2 forks source link

error: unable to open datebase #9

Closed yunnant closed 5 years ago

yunnant commented 5 years ago
  1. macOS Mojave, Version 10.14.2
  2. Ubersicht Version 1.3
  3. top-cpu, netstat, simple-clock, weather, reminders (not working)

Hi, can you help me with this issue, it says "Error: unable to open database "/Users/yunnantao/Library/Calendars/Calendar Cache?mode=ro": unable to open database file"

davidlday commented 5 years ago

Is this a new install / setup, or was this working on Sierra and stopped working on an upgrade to Mojave?

My first guess is that you haven't used the macOS Reminders app or Calendar and so the Calendar Cache doesn't exist yet. But it may also be a security issue. Can you confirm the file is there by:

  1. open your favorite terminal
  2. cd /Users/yunnantao/Library/Calendars/
  3. ls -al
  4. confirm Calendar Cache is in that directory
yunnant commented 5 years ago

Yes, it is a new install. And I have used it, I guess this is the cache.

2018-12-31 10 30 40
davidlday commented 5 years ago

I had similar issues under issue #3 but I think this is a problem with permission. Can you please run the following in the terminal. Please let me know if you get a security prompt and what, if any, results come back:

sqlite3 "file:$HOME/Library/Calendars/Calendar Cache?mode=ro" "SELECT ztitle FROM znode WHERE z_ent=42 AND zistaskcontainer=1"
yunnant commented 5 years ago

Yes, there is a prompt. And I have added the permission to ubersicht and it works. Thank you and Happy New Year!

davidlday commented 5 years ago

You're welcome! Happy New Year to you, too!

oc777 commented 5 years ago

I am having the same issue on Mojave 10.14.2 Error: unable to open database "file:..."

How can add permissions to uberischt?

davidlday commented 5 years ago

I believe this is corrected by granting Ubersicht access to your Calendars under "Security & Privacy" in "System Preferences":

image

Go to "System Preferences" -> "Security & Privacy" and select "Calendar" on the left. Then in Finder got to "Applications", select the Ubersicht app, and drag it onto the right side of the "Security & Privacy" panel to add it.

Let me know if this works or not.

oc777 commented 5 years ago

Ubersicht doesn't request access to Calendars by itself and I can't add it myself. I've granted Ubersicht a Full Disk Access and the error disappeared, but the widget is not showing up. Tried deleting caches and reinstalling the widget to no avail.

davidlday commented 5 years ago

Hmmm - you should be able to find Ubersicht in your "Applications" folder and just drag it into the "Allow the apps below to access your calendars." But, I haven't tested this out. I don't think Ubersicht will request access because it's one of my underlying scripts that needs access. When I experienced this, I was testing the underlying script in the Terminal, received a pop up, and granted the script access.

I should have time in the next day or so to reset permissions on Ubersicht and see if I can recreate the situation. You might try what I suggested above and run the following in a Terminal:

sqlite3 "file:$HOME/Library/Calendars/Calendar Cache?mode=ro" "SELECT ztitle FROM znode WHERE z_ent=42 AND zistaskcontainer=1"

You'll probably get a pop up, as yunnant did above. It might be that Terminal also requires access, which you can see from my screenshot I did as well.

I'll reopen this until we have you working.

oc777 commented 5 years ago

When I ran the sqlite command, it was the Terminal app that asked for permission, not Ubersicht. Dragging and dropping Ubersicht app to Calendars permissions window in System Preferences is not working. I was looking for a solution on how to grant permissions to a specific app without it explicitly requesting it, and it looks like the only thing you can do is to grant it Full Disk Access. Which I did. And as I said - it solved the issue with the error about DB access.

Now it just not showing any tasks, like in the issue#3.

When I run

cd "$HOME/Library/Application Support/Übersicht/widgets/reminders.widget" ./pending.sh

I get the list of my tasks

Running sqlite3 "file:$HOME/Library/Calendars/Calendar Cache?mode=ro" "SELECT ztitle FROM znode WHERE z_ent=42 AND zistaskcontainer=1" returns nothing

I've tried running Reminders widget using both the lates release on GitHub and the reminders.widget.hotfix.zip from here

None of them worked. Debug console doesn't return anything.

My system:

  1. macOS Mojave v 10.14.2
  2. Ubersicht v 1.3
  3. widgets installed: devicebatt.widget
yunnant commented 5 years ago

I gave Ubersicht the whole access to the disk, maybe you can try it.

davidlday commented 5 years ago

The only place I have Ubersicht is in the Calendars setting, and I verified if I disable there, my widget breaks. When I re-enable it, my widget works. I do not have Ubersicht in "Full Disk Access".

@oc777 I hate to ask, but do you have any items in your Reminders lists? And can you please run this SQL in Terminal:

sqlite3 "file:$HOME/Library/Calendars/Calendar Cache?mode=ro" "SELECT zduedate, zpriority, rem.ztitle AS title, cal.ztitle AS list, rem.znotes AS notes FROM zcalendaritem rem LEFT JOIN znode cal ON rem.zcalendar=cal.z_pk WHERE rem.z_ent=6 AND zcompleteddate IS NULL ORDER BY CASE WHEN zduedate IS NULL THEN 1 ELSE 0 END, zduedate, zpriority;"

This should give a list of all reminders you have. Please post the output (or at least a portion if you have private tasks on there).

oc777 commented 5 years ago

Yes :) I have a whole bunch of tasks. And the query you provided returns them all. The output:

570106800||Test reminders.widget|TODO|let's go!
570621600||Web Based #3|uni|
||Buy Credits iPhrame|SD|
...
|0|Server_side|TODO|hhkhkkk

As mentioned previously:

When I run

cd "$HOME/Library/Application Support/Übersicht/widgets/reminders.widget" ./pending.sh

I get the list of my tasks

Running sqlite3 "file:$HOME/Library/Calendars/Calendar Cache?mode=ro" "SELECT ztitle FROM znode WHERE z_ent=42 AND zistaskcontainer=1" returns nothing

davidlday commented 5 years ago

Okay - so this may be broken after all since that last query is returning nothing. Unfortunately, I'm going to be away from my Mac for most of the week, and this will have to wait until probably next Friday. I'll think it over and let you know if I have any other suggestions you can try in the mean time.

oc777 commented 5 years ago

The problem seems to happen because pending.sh is returning an empty array of lists "lists": []

Removing z_ent=$CALDAVCALENDAR AND and leaving only WHERE zistaskcontainer=1; in "get all list names" query lists solves the issue

davidlday commented 5 years ago

Sorry for the delay. I was out of town for a week. I'll poke around today and tomorrow and see if I can verify and fix.

davidlday commented 5 years ago

@oc777 - looks like you're right. I've removed the z_ent=$CALDAVCALENDAR qualifier and it still appears to work as expected. I've packaged up the changes and attached the new zip. Please test it out, and if it works for you as well I'll commit the changes. Thank you!

reminders.widget.zip

davidlday commented 5 years ago

@oc777 - way late, but is this still a problem? I had to make significant changes for Catalina and want to make sure the problems you were having are addressed as well.

davidlday commented 5 years ago

Closing this out as stale. Please reopen if there's still an issue.