sballin/alfred-search-notes-app

Error in python getNotes function

Closed this issue · 3 comments

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):

  • OS: catalina 10.15.3
  • Alfred version: 4.0.8
  • Workflow version: 2.0.0 (latest as of March 2020)

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.

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.

Should be fixed as of version 2.1.0.