sobjornstad / AnkiLPCG

Addon for dae/anki for studying lyrics and poetry
https://ankilpcg.readthedocs.io/en/latest/index.html
GNU General Public License v3.0
155 stars 22 forks source link

Bug report from Anki #24

Closed akrulwich closed 3 years ago

akrulwich commented 3 years ago

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.
akrulwich commented 3 years ago

The text was in Hebrew if that helps

akrulwich commented 3 years ago

So was the title

akrulwich commented 3 years ago

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

sobjornstad commented 3 years ago

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.

akrulwich commented 3 years ago

Thanks!

On Sun, Nov 15, 2020 at 17:26 Soren Bjornstad notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sobjornstad/AnkiLPCG/issues/24#issuecomment-727587535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB24HSVKXENOKKX5I55VRB3SP7XKHANCNFSM4TWFRA7A .

k12ish commented 3 years ago

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.
sobjornstad commented 3 years ago

@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.

k12ish commented 3 years ago

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

sobjornstad commented 3 years ago

@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.