Creating a new card in an imported deck

hi folks,
I imported a deck and wanted to create a new card, but get an error:
Debug info:
Anki 2.1.64 (581f82c5) Python 3.9.15 Qt 6.4.3 PyQt 6.4.0
Platform: Windows-10-10.0.19044
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2023-05-27 17:27:30

Caught exception:
Traceback (most recent call last):
File “sre_parse”, line 1051, in parse_template
KeyError: ‘\d’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “aqt.webview”, line 604, in handler
File “aqt.reviewer”, line 659, in _onTypedAnswer
File “aqt.reviewer”, line 423, in showAnswer
File “aqt.reviewer”, line 353, in mungeQA
File "C:\Users\an\AppData\Roaming\Anki2\addons21\681236951_init
.py", line 27, in typeboxAnsFilter
return self.typeboxAnsAnswerFilter(buf)
File "C:\Users\an\AppData\Roaming\Anki2\addons21\681236951_init
.py", line 141, in typeboxAnsAnswerFilter
return re.sub(self.typeboxAnsPat, s, buf)
File “re”, line 210, in sub
File “re”, line 327, in _subx
File “re”, line 318, in _compile_repl
File “sre_parse”, line 1054, in parse_template
re.error: bad escape \d at position 243 (line 9, column 100)

my templates are:

front

{{Front}}


{{hint:Hint}}




[[typebox:Back]]
#back
{{FrontSide}}


{{Back}} # styling .card { font-family: arial; font-size: 20px; text-align: center; color: black; background-color: white; } textarea { height: 300px; } .hint { color: red; font-size: 1rem }

I think the problem is the “backslash”. The card is about a PowerShell command:
copy-item c:\temp\a.txt -destination c:\temp\folder\b.txt → results in error
writing:
copy-item c:\\temp\\j.txt -destination c:\\temp\\b.txt → no error (but it’s no valid PowerShell command).

thanks for your help

The relevant add-on is not longer under active development, the issue with backslashes has been brought up before and there also seems to be a fix available.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.