anki-connect icon indicating copy to clipboard operation
anki-connect copied to clipboard

addNote error: Exception: cannot create note because it is empty

Open valuex opened this issue 3 years ago • 1 comments

I've update AnkiConnect for Anki 2.1.38 today. And get an error message as:

Exception: cannot create note because it is empty

Kindly help to point out how to fix it, thanks.

#!/usr/bin/env python

import util

def runTest():
    options = {
        'allowDuplicate': True
    }

    note1 = {
        'deckName': 'NewWords',
        'modelName': 'Basic',
        'fields': {'Front': 'front1', 'Back': 'back1'},
        'tags': ['tag1'],
        'options': options
    }

    # addNote
    noteId = util.invoke('addNote', note=note1)

if __name__ == '__main__':
   runTest()

valuex avatar Mar 05 '21 16:03 valuex

Huh, My fault. I changed the fields name as Front and Back, and get it solved.

valuex avatar Mar 06 '21 04:03 valuex