Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note ID AssertionError when adding notes on Anki 2.1.28+ #42

Closed
5 of 8 tasks
zjosua opened this issue May 26, 2020 · 6 comments
Closed
5 of 8 tasks

Note ID AssertionError when adding notes on Anki 2.1.28+ #42

zjosua opened this issue May 26, 2020 · 6 comments
Assignees
Labels
bug Something isn't working high priority High priority regression Regression from an earlier release

Comments

@zjosua
Copy link
Contributor

zjosua commented May 26, 2020

Problem description

When creating new notes with overlapping clozes, there is an AssertionError (see below), because there is no id for the new note yet.
I think that the issue was introduced with ankitects/anki@f637ac9#diff-4a37772b551db2baaf677e04d51a3c04, but I'm not sure.

Checklist

  • I've restarted Anki to see if it helps
  • I've verified that I use the latest version of the add-on by redownloading it from AnkiWeb
  • I use Cloze Overlapper's commit 9eabb6a built with aab
  • I've verified that I use the latest version of Anki by checking at https://apps.ankiweb.net#download
  • I run Anki from source
  • I've tried to disable other add-ons to see if there are any interactions present
  • My issue disappears when I hold shift while starting Anki.
  • I've checked if anyone else reported this problem before by looking through the issue reports. I also checked to see if there is a section about known issues in the add-on description, documentation, or README.

Information about your Anki set-up

If you are using Anki 2.1

Debug Info:

    
    Anki 2.1.28 (eb032c4e) Python 3.8.3 Qt 5.12.5 PyQt 5.14.2
    Platform: Linux
    Flags: frz=False ao=True sv=2
    Add-ons, last update check: 2020-05-26 20:07:18
    
    
    ===Add-ons (active)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])
    '' ['hourly_breakdown', 0, 'None', '']
    '' ['print_as_flashcards', 0, 'None', '']
    '' ['puppy_reinforcement', 0, 'None', '']
    '' ['right_hand_reviews', 0, 'None', mod]
    '' ['tagedit_subtag_completer', 0, 'None', '']
    Add Hyperlink ['318752047', 2020-04-03T18:06, 'None', '']
    Anki Zoom ['538879081', 2020-04-04T02:20, 'v1.1.3', '']
    AnkiWebView Inspector ['31746032', 2019-05-03T00:43, 'None', '']
    Batch Editing ['291119185', 2019-06-17T17:52, 'None', '']
    Cloze Overlapper ['cloze_overlapper', 2019-08-11T08:03, 'None', '']
    Extended Card Stats During Review ['1008566916', 2018-10-03T14:53, 'None', '']
    Extended Schema Hash ['1187737890', 2020-01-19T14:09, 'None', '']
    Field History ['1247884413', 2019-01-08T19:34, 'None', mod]
    Frozen Fields ['516643804', 2020-03-01T05:12, 'None', '']
    Hierarchical Tags ['anki-hierarchical-tags', 0, 'None', '']
    Highlight Search Results in the Browser ['225180905', 2019-11-27T16:06, 'None', '']
    Image Occlusion Enhanced ['image_occlusion_enhanced', 2019-09-11T13:45, 'None', '']
    Leaderboard ['41708974', 2020-05-07T12:22, 'None', mod]
    Mini Format Pack ['mini_format_pack', 2019-08-12T09:37, 'None', '']
    Multiple Choice for Anki ['1566095810', 2020-04-10T07:50, 'None', '']
    Opening the same window multiple time ['354407385', 2020-05-16T02:59, 'None', '']
    Pop-up Dictionary ['popup_dictionary', 2019-10-18T20:28, 'None', '']
    Quick tagging 21 ['304770511', 2020-02-11T07:17, 'None', mod]
    Review Heatmap ['review_heatmap', 2020-03-22T06:57, 'None', '']
    Search and Replace Tags ['138501288', 2018-10-01T16:47, 'None', '']
    Spell Check ['spell_check', 2020-03-17T13:19, 'None', '']
    Symbols ['1461102936', 2019-06-17T17:52, 'None', mod]
    Trigger and actions change one card depending on what occurs on another card ['1981494159', 2020-05-04T22:53, 'None', mod]
    Visual Feedback for Reviews ['review_feedback', 2020-01-29T20:43, 'None', '']
    
    ===IDs of active AnkiWeb add-ons===
    1008566916 1187737890 1247884413 138501288 1461102936 1566095810 1981494159 225180905 291119185 304770511 31746032 318752047 354407385 41708974 516643804 538879081
    
    ===Add-ons (inactive)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])
    Anki Habitica for 21 ['1758045507', 2020-03-24T09:28, 'None', mod]
    Keep model of add cards ['424778276', 2020-05-17T01:18, 'None', '']

Error message (if any)

Caught exception:
Traceback (most recent call last):
  File "/home/zjosua/sw_dev/anki/qt/aqt/webview.py", line 467, in handler
    cb(val)
  File "/home/zjosua/sw_dev/anki/qt/aqt/editor.py", line 477, in <lambda>
    self.web.evalWithCallback("saveNow(%d)" % keepFocus, lambda res: callback())
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/editor.py", line 154, in <lambda>
    editor.saveNow(lambda: callback(editor, *args, **kwargs))
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/editor.py", line 283, in onOlClozeButton
    return onFieldReady()
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/editor.py", line 270, in onFieldReady
    overlapper.add()
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/overlapper.py", line 117, in add
    self.updateNote(fields, full, setopts, custom)
  File "/home/zjosua/.local/share/Anki2/addons21/cloze_overlapper/overlapper.py", line 206, in updateNote
    note.flush()
  File "/home/zjosua/sw_dev/anki/pylib/anki/notes.py", line 66, in flush
    assert self.id != 0
AssertionError
@zjosua zjosua added the bug Something isn't working label May 26, 2020
@glutanimate glutanimate self-assigned this Jul 27, 2020
@glutanimate glutanimate added the regression Regression from an earlier release label Jul 27, 2020
@glutanimate glutanimate added this to the v0.4.0 milestone Jul 27, 2020
@glutanimate glutanimate changed the title Error when adding notes Note ID AssertionError when adding notes on Anki 2.1.28+ Aug 16, 2020
@glutanimate glutanimate added the high priority High priority label Aug 16, 2020
@glutanimate glutanimate modified the milestones: v0.4.0, v1.0.0-alpha.1 Aug 16, 2020
@glutanimate
Copy link
Owner

glutanimate commented Aug 16, 2020

Thanks for catching this so early @zjosua (and sorry for taking so long to get to it). A fix will land in the upcoming v1.0.0-alpha.1 release.

@glutanimate
Copy link
Owner

Fixed in the current development branch.

@Qonrad
Copy link

Qonrad commented Aug 17, 2020

Fixed in the current development branch.

Is the development branch on GitHub? I'm only seeing the master and anki20 branches.

@glutanimate glutanimate mentioned this issue Sep 4, 2020
6 tasks
@mhrsolanki2020
Copy link

Fixed in the current development branch.

Is there any way for us to participate in testing in the development branch?

@michalrus
Copy link

michalrus commented Feb 19, 2023

@Qonrad @mhrsolanki2020 while waiting for the official release, you can check out a pure JavaScript template – https:/michalrus/anki-simple-cloze-overlapper

@mewmew419
Copy link

i dont know if anyone will see this. i've been trying to import a genki deck but i keep getting assertion error i have no clue how to fix this nor do i understand programming speak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority High priority regression Regression from an earlier release
Projects
None yet
Development

No branches or pull requests

5 participants