sballin / alfred-search-notes-app

Use Alfred to quickly open notes in iCloud/Apple Notes.
https://www.alfredforum.com/topic/11716-search-appleicloud-notes/
MIT License
510 stars 24 forks source link

Error in python getNotes function #20

Closed sambauwens closed 4 years ago

sambauwens commented 4 years ago

Describe the bug

When I type n or nb or nf, it shows "Search Notes" / "Notes Bodies"... respectively, but then switched to google search.

I checked the debug log output, first it was because python3 was not installed, so I had to install via homebrew, which required the latest version of xcode. So now I have the latest version of xcode and python3.

Now I still have the same erratic behaviour, but now with a different error in the logs. Maybe I have the wrong version of python ? Which version is required.

I suggest putting these requirements in the repo readme :)

Log Output

[10:06:37.564] Logging Started...
[10:06:45.002] Search Notes[Script Filter] Queuing argument '(null)'
[10:06:45.176] Search Notes[Script Filter] Script with argv '(null)' finished
[10:06:45.179] ERROR: Search Notes[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/sam/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1DC8A72D-6AE1-4164-A099-E4F86C168D83/get_notes.py", line 126, in <module>
    print(getNotes(searchBodies=False))
  File "/Users/sam/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1DC8A72D-6AE1-4164-A099-E4F86C168D83/get_notes.py", line 88, in getNotes
    dbItems = sorted(dbItems, key=lambda d: d[sortId], reverse=sortInReverse)
TypeError: '<' not supported between instances of 'NoneType' and 'float'

To Reproduce

Basically use the workflow (I mean nothing works for me).

Desktop (please complete the following information):

sballin commented 4 years ago

I tested this with a fresh install of MacOS. When I try to run the workflow for the first time, I'm prompted to install the developer tools (did that happen for you?), and the workflow works after that. Then I installed homebrew and found that it also works if I do brew install python3. Is all this different from what you did?

I think the error in the log you're showing means that your Notes database has some non-float values in the zmodificationdate1 column. Would you say there's anything unusual about your usage of Notes? Is it connected to an iCloud account or no?

You can also try version 1.4.3 and see if that works.

sambauwens commented 4 years ago

I don't recall being prompted to install developper tools, maybe because I'm a developper and already had xcode installed (but previous version 10, which was too outdated for homebrew).

I did exactly brew install python3.

I'm using iCloud yes. Other than that I'm a pretty heavy user of Apple Notes, but I don't know in what way my usage would be particularly unusual.

I will try 1.4.3.

sballin commented 4 years ago

Should be fixed as of version 2.1.0.