sobjornstad / TiddlyRemember

Embed Anki notes in your TiddlyWiki
https://sobjornstad.github.io/TiddlyRemember/
MIT License
65 stars 7 forks source link

AttributeError: '_Collection' object has no attribute 'find_notes'` #8

Closed LuccaHellriegel closed 4 years ago

LuccaHellriegel commented 4 years ago

Hello sobjornstad, thanks a lot for this cool project!

However, when I am trying to execute the sync, I get the following error from the Anki Plugin:

Debuginformationen:
Anki 2.1.22 (0ecc189a) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-06-01 14:55:24
Möglicherweise beteiligte Erweiterungen: ⁨TiddlyRemember⁩

Caught exception:
Traceback (most recent call last):
  File "/home/hel/.local/share/Anki2/addons21/60456529/__init__.py", line 166, in join_thread
    return self.sync()
  File "/home/hel/.local/share/Anki2/addons21/60456529/__init__.py", line 176, in sync
    userlog = ankisync.sync(self.notes, self.mw, self.conf)
  File "/home/hel/.local/share/Anki2/addons21/60456529/ankisync.py", line 104, in sync
    for nid in mw.col.find_notes(model_search))
AttributeError: '_Collection' object has no attribute 'find_notes'

I printed the mw.col object as a dir:

[   '__annotations__',
    '__class__',
    '__delattr__',
    '__dict__',
    '__dir__',
    '__doc__',
    '__eq__',
    '__format__',
    '__ge__',
    '__getattribute__',
    '__gt__',
    '__hash__',
    '__init__',
    '__init_subclass__',
    '__le__',
    '__lt__',
    '__module__',
    '__ne__',
    '__new__',
    '__reduce__',
    '__reduce_ex__',
    '__repr__',
    '__setattr__',
    '__sizeof__',
    '__str__',
    '__subclasshook__',
    '__weakref__',
    '_closeLog',
    '_debugLog',
    '_dueForDid',
    '_fieldData',
    '_lastSave',
    '_loadScheduler',
    '_logHnd',
    '_logRem',
    '_markOp',
    '_newCard',
    '_normalize_tags',
    '_openLog',
    '_remNotes',
    '_tmplsFromOrds',
    '_undo',
    '_undoOp',
    '_undoReview',
    '_usn',
    'addNote',
    'autosave',
    'backend',
    'basicCheck',
    'beforeUpload',
    'cardCount',
    'cardStats',
    'changeSchedulerVer',
    'clearUndo',
    'close',
    'conf',
    'crt',
    'db',
    'decks',
    'dty',
    'emptyCardReport',
    'emptyCids',
    'findCards',
    'findDupes',
    'findNotes',
    'findReplace',
    'findTemplates',
    'fixIntegrity',
    'flush',
    'genCards',
    'getCard',
    'getNote',
    'isEmpty',
    'load',
    'localOffset',
    'lock',
    'log',
    'ls',
    'markReview',
    'media',
    'mod',
    'modSchema',
    'models',
    'name',
    'newNote',
    'nextID',
    'noteCount',
    'optimize',
    'path',
    'previewCards',
    'remCards',
    'remNotes',
    'reopen',
    'reset',
    'rollback',
    'save',
    'sched',
    'schedVer',
    'schemaChanged',
    'scm',
    'server',
    'setMod',
    'setUserFlag',
    'startTimebox',
    'stats',
    'supportedSchedulerVersions',
    'tags',
    'timeboxReached',
    'tr',
    'undo',
    'undoName',
    'updateFieldCache',
    'usn',
    'weakref']

So, there exists a "findNotes" but not "find_notes". I dont know how this could have happend, because in the source-code I only find a "find_notes"-definition (but that seems to be something different). When I change it to "findNotes" it works. Maybe "aqt.mw" is different in my version of Anki?

sobjornstad commented 4 years ago

A quick search through the Git history reveals that the first version that contains find_notes is 2.1.24. I'll update the plugin metadata so it won't allow an install until you update to .24 or greater (that's a couple versions behind already by now).

I just took an educated guess at the earliest version that I supported, based on the Anki release notes, and it appears I guessed wrong. :grin: