sobjornstad / AnkiLPCG

Addon for dae/anki for studying lyrics and poetry

Home Page:https://ankilpcg.readthedocs.io/en/latest/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug report from Anki

akrulwich opened this issue · comments

Hi,‎ this is probably my fault some how but I had an error message when generating cards so I'm posting it here

Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.14.6
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-11-15 14:21:47
Add-ons possibly involved: ⁨LPCG LyricsPoetry Cloze Generator⁩

Caught exception:
Traceback (most recent call last):
  File "/Users/allen/Library/Application Support/Anki2/addons21/2084557901/lpcg_dialog.py", line 48, in accept
    if self.mw.col.findNotes(f'"note:{models.LpcgOne.name}" "Title:{title}"'):  # pylint: disable=no-member
  File "anki/collection.py", line 453, in find_notes
  File "anki/rsbackend_gen.py", line 88, in search_notes
  File "anki/rsbackend.py", line 267, in _run_command
anki.rsbackend.InvalidInput: Invalid search - please check for typing mistakes.

The text was in Hebrew if that helps

So was the title

Looks like the problem was a double quote in the title.‎ Hopefully could be supported in future,‎ thanks!

Thanks for this report! When I originally wrote this, Anki didn't support escaping quotation marks in searches, so it wasn't possible to make this work, but now it is so I will have a look at fixing this.

commented

Any progress on the issue? I've got what looks like the same bug here :/

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, repeat 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-ons section of our support site. 
Debug info:
Anki 2.1.40 (cf446733) Python 3.8.1 Qt 5.15.1 PyQt 5.15.1
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-02-27 09:06:04
Add-ons possibly involved: ⁨LPCG LyricsPoetry Cloze Generator⁩

Caught exception:
Traceback (most recent call last):
  File "/home/krish/.local/share/Anki2/addons21/2084557901/lpcg_dialog.py", line 48, in accept
    if self.mw.col.findNotes(f'"note:{models.LpcgOne.name}" "Title:{title}"'):  # pylint: disable=no-member
  File "anki/collection.py", line 458, in find_notes
  File "anki/rsbackend_gen.py", line 81, in search_notes
  File "anki/rsbackend.py", line 256, in _run_command
anki.rsbackend.InvalidInput: Invalid search - please check for typing mistakes.

@k12ish Haven't gotten around to releasing a new version yet as I'm really busy with other projects right now, but you should be able to work around it just by removing any quotation marks from the title.

commented

My search was Explain why \(\ce{OH}\) is upfield?, which does not contain any quotation marks. I thought your code had a bug yesterday ( and I forgot to tell you the search term like an idiot )

It appears to be an upstream issue, so you're off the hook:
image

@k12ish: I think you want \\(\\ce{OH}\\). The backslash has special meaning and thus needs to be escaped.

And to be clear, LPCG doesn't change anything with Anki's searching, so your problem is definitely not related to LPCG. This issue is caused by LPCG itself running a search internally with values provided by the user.