Hey, I created an addon for my own work and it is not published on anki’s website. The objective of the addon is to populate a field at the time of the answer with text from a different card.
Source code of the add-on: Link
The add-on works through the CID_Index
field in cards, if the CID_Index field exists and it is not empty, the add-on will to find the card and populate another field called Index
in the card.
The Index
field is added to the cards in the following manner:
<div class="index_data">{{edit:Index:}}</div>
<script>
txt = document.querySelector(".index_data").textContent;
if (txt == "") {
document.querySelector(".index_data").innerHTML = "No Index";
}
</script>
The add-on works fine with cards that have a CID_Index but in other instances it throws the following error:
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 to the add-on author.
Debug info:
Anki 2.1.65 (aa9a734f) Python 3.9.15 Qt 6.4.3 PyQt 6.4.0
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-07-09 13:18:28
Caught exception:
Traceback (most recent call last):
File "aqt.webview", line 46, in cmd
File "aqt.webview", line 153, in _onCmd
File "aqt.webview", line 662, in _onBridgeCmd
File "aqt.overview", line 92, in _linkHandler
File "aqt.main", line 712, in moveToState
File "aqt.main", line 733, in _reviewState
File "aqt.reviewer", line 161, in show
File "aqt.reviewer", line 181, in refresh_if_needed
File "aqt.reviewer", line 243, in nextCard
File "aqt.reviewer", line 361, in _showQuestion
File "anki.cards", line 129, in question
File "anki.cards", line 145, in render_output
File "anki.template", line 235, in render
File "anki.template", line 339, in apply_custom_filters
TypeError: can only concatenate str (not "NoneType") to str
Can someone please help me debug this? I tried multiple thing but couldn’t understand why this is happening.
Thanks in advance!