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

Anki Error: Caught exception #22

Open
lamyergeier opened this issue Aug 14, 2020 · 4 comments
Open

Anki Error: Caught exception #22

lamyergeier opened this issue Aug 14, 2020 · 4 comments

Comments

@lamyergeier
Copy link

Anki Error

An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.29 (bbff62bf) Python 3.8.1 Qt 5.15.0 PyQt 5.15.0
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-08-14 12:40:27
Add-ons possibly involved: ⁨Auto Markdown⁩

Caught exception:
Traceback (most recent call last):
  File "aqt/webview.py", line 490, in handler
  File "aqt/editor.py", line 479, in <lambda>
  File "aqt/editor.py", line 345, in _onFields
  File "/home/nikhil/.local/share/Anki2/addons21/1030875226/fields.py", line 18, in fieldDialog__init__
    self.model = note.model()
AttributeError: 'dict' object has no attribute 'model'
@dallanlee
Copy link

I'm getting the exact same AttributeError.

To try to fix the issue, I completely deleted Anki for macOS, removing all related files in ~/Library/… and downloaded it again and installed it. Even with no cards (while not synced to my account) or other add-ons, I still get the error on a fresh install.

I'm running macOS 10.15.6 and Anki 2.1.32 (as you can see in my pasted 'Error' output below).

An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.32 (dee7d45d) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.15.6
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-08-27 10:40:58
Add-ons possibly involved: ⁨Auto Markdown⁩

Caught exception:
Traceback (most recent call last):
  File "aqt/webview.py", line 493, in handler
  File "aqt/editor.py", line 481, in <lambda>
  File "aqt/editor.py", line 352, in _onFields
  File "/Users/…/Library/Application Support/Anki2/addons21/1030875226/fields.py", line 18, in fieldDialog__init__
    self.model = note.model()
AttributeError: 'dict' object has no attribute 'model'

@zhollow
Copy link

zhollow commented Sep 22, 2020

same issue

@zhollow
Copy link

zhollow commented Sep 22, 2020

I found two approaches that solved this problem.

A quick fix

Just go to Tools-> Add-ons -> Auto Markdown, and click the configbutton. You will see something like this:

{
    "auto": {
        "enabled": true,
        "uiEditFieldCheckbox": true
    },
    "code": {
        "colorScheme": "default",
        "lineNums": true
    },
    "manual": {
        "shortcut": "Ctrl+M",
        "uiToggleFieldMarkdownButton": true
    }
}

Change the line "uiEditFieldCheckbox": true to "uiEditFieldCheckbox": false.

another fix

open the file fields.py showed in the error information and replace the function fieldDialog__init with the following function:

def fieldDialog__init__(self, mw, nt, ord=0, parent=None):
    QDialog.__init__(self, parent or mw)
    self.mw = aqt.mw
    self.parent = parent or mw
    self.col = self.mw.col
    self.mm = self.mw.col.models
    self.model = nt
    self.note = nt
    self.mm._remove_from_cache(self.model["id"])
    self.mw.checkpoint(_("Fields"))
    self.change_tracker = ChangeTracker(self.mw)
    self.form = aqt.forms.fields.Ui_Dialog()
    self.form.setupUi(self)

    self.markdownCheckbox = QCheckBox("Convert to/from markdown automatically")
    row = self.form._2.rowCount() + 1
    self.form._2.addWidget(self.markdownCheckbox, row, 1)

    self.setWindowTitle(_("Fields for %s") % self.model["name"])
    self.form.buttonBox.button(QDialogButtonBox.Help).setAutoDefault(False)
    self.form.buttonBox.button(QDialogButtonBox.Cancel).setAutoDefault(False)
    self.form.buttonBox.button(QDialogButtonBox.Save).setAutoDefault(False)
    self.currentIdx = None
    self.oldSortField = self.model["sortf"]
    self.fillFields()
    self.setupSignals()
    self.form.fieldList.setDragDropMode(QAbstractItemView.InternalMove)
    self.form.fieldList.dropEvent = self.onDrop
    self.form.fieldList.setCurrentRow(0)
    self.exec_()

@philosopherdog
Copy link

Neither solution worked for me. Still seeing the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants