piazzatron / anki-smart-notes

Superchange your anki flashcards with ✨AI✨
GNU General Public License v3.0
8 stars 2 forks source link

Startup error: FIle not found [manifest.json] #5

Closed taurit closed 1 week ago

taurit commented 1 week ago

Hi, and thanks for sharing the addon!

After upgrading the addon to 1.1.0, I started to receive the following error every time Anki starts:

obraz

It also prevents me from going into Config: obraz

Here's a stack trace and diagnostic information:

Anki 24.06.2 (33a92379)  (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.22631

Traceback (most recent call last):
  File "aqt.progress", line 119, in handler
  File "aqt.main", line 220, in on_window_init
  File "_aqt.hooks", line 3553, in __call__
  File "C:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\src\hooks.py", line 59, in inner
    return fn(processor, *args, **kwargs)
  File "C:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\src\hooks.py", line 191, in on_main_window
    perform_update_check()
  File "C:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\src\ui\changelog.py", line 62, in perform_update_check
    current_version = get_version()
  File "C:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\src\ui\changelog.py", line 31, in get_version
    manifest = load_file("manifest.json")
  File "C:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\src\utils.py", line 102, in load_file
    with open(file_path, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\windo\\AppData\\Local\\Programs\\Anki\\manifest.json'

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AwesomeTTS - Add speech to your flashcards ['1436550454', 2024-06-01T16:05, 'None', '']
Paste Images As WebP ['1151815987', 2024-04-23T12:42, 'None', mod]
Smart Notes - AI Generated Fields with ChatGPT-4o 35 etc ['1531888719', 2024-06-18T21:37, 'None', mod]

===IDs of active AnkiWeb add-ons===
1151815987 1436550454 1531888719

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['overview_refresh_media', 0, 'None', '']

It seems that the addon might be looking for manifest.json in a wrong path? On my machine: C:\Users\windo\AppData\Local\Programs\Anki\manifest.json indeed doesn't exist, but the following does: c:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\manifest.json Maybe that's what was attempted to read?

piazzatron commented 1 week ago

Hey @taurit, thanks for reporting and for providing a stack trace. I suspect this is a platform specific issue (why I didn't catch it on Mac) - sorry you're experiencing this, will get a bug fix out ASAP and report back here.

piazzatron commented 1 week ago

Should be fixed if you initiate an update now. Please let me know if you're still running into it.

taurit commented 1 week ago

Wow, that was quick, thanks for taking up the issue @piazzatron :)

The error no longer occurs when I launch Anki. I still cannot go to Tools -> Add-ons -> (select Smart Notes add-on) -> Config, but the stack trace is different now:

Anki 24.06.2 (33a92379)  (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.22631

Traceback (most recent call last):
  File "aqt.addons", line 1024, in onConfig
  File "C:\Users\windo\AppData\Roaming\Anki2\addons21\1531888719\src\hooks.py", line 59, in inner
    return fn(processor, *args, **kwargs)
TypeError: on_options() missing 1 required positional argument: 'second'

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AwesomeTTS - Add speech to your flashcards ['1436550454', 2024-06-01T16:05, 'None', '']
Paste Images As WebP ['1151815987', 2024-04-23T12:42, 'None', mod]
Smart Notes - AI Generated Fields with ChatGPT-4o 35 etc ['1531888719', 2024-06-19T10:15, 'None', mod]

===IDs of active AnkiWeb add-ons===
1151815987 1436550454 1531888719

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['overview_refresh_media', 0, 'None', '']

Thanks for your help!

piazzatron commented 1 week ago

Well, that issue probably bricked all my windows users so I figured I should be quick 😅

Just released a new version that should fix the add-ons -> config bug. Going to keep this thread open because you keep finding good ones.

taurit commented 1 week ago

@piazzatron Thanks for the fix! The configuration window opens now, and the add-on seems functional on Windows.

There is one more issue on Windows that was present in the previous versions (e.g., 1.0.0) too, but I'm not sure if it's 100% reproducible and in what cases. Currently, it seems to always appear when I use the add-on to generate some context and close the "Add" window. Video:

https://github.com/piazzatron/anki-smart-notes/assets/7702278/51655162-dca5-4ee1-8bef-2afcf22aa480

Stack trace:

Anki 24.06.2 (33a92379)  (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.22631

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000002B22776AC10>
Traceback (most recent call last):
  File "asyncio.proactor_events", line 116, in __del__
  File "asyncio.proactor_events", line 108, in close
  File "asyncio.base_events", line 751, in call_soon
  File "asyncio.base_events", line 515, in _check_closed
RuntimeError: Event loop is closed
Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
AttributeError: 'ErrorHandler' object has no attribute 'flush'
===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AwesomeTTS - Add speech to your flashcards ['1436550454', 2024-06-01T16:05, 'None', '']
Paste Images As WebP ['1151815987', 2024-04-23T12:42, 'None', mod]
Smart Notes - AI Generated Fields with ChatGPT-4o 35 etc ['1531888719', 2024-06-19T20:32, 'None', mod]

===IDs of active AnkiWeb add-ons===
1151815987 1436550454 1531888719

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['overview_refresh_media', 0, 'None', '']

This is not critical (add-on still works), but when I work with adding new cards, it appears many times and requires some attention to close the popup.

Thanks again for your support!

piazzatron commented 1 week ago

This looks like a fun one 😀

Thank you for the quality bug reporting, it's invaluable for helping me figure these out.

piazzatron commented 1 week ago

@taurit I put up a fix for the event loop bug – firing in the dark a bit here since it's platform specific, but I'm hopeful this will work. LMK when you get a chance

taurit commented 1 week ago

Thank you for the quality bug reporting, it's invaluable for helping me figure these out.

Sure thing, thanks for taking up the issue! I'm happy to have such useful addon working reliably now.

I put up a fix for the event loop bug – firing in the dark a bit here since it's platform specific, but I'm hopeful this will work. LMK when you get a chance

I just tested it, looks great! The bug no longer reproduces in the scenario described earlier. I also worked with Anki for a few minutes (in case it was triggered in other scenarios too) but no errors were displayed. Looks like it's working and stable in Windows at the moment :)

piazzatron commented 1 week ago

That's great! Thank you for being the Windows beta tester.

I noticed you have a field for images in your card - would an image gen smart field be valuable for your use case? It's something I've been considering building out here

taurit commented 6 days ago

@piazzatron

That's great! Thank you for being the Windows beta tester.

My pleasure :)

I noticed you have a field for images in your card - would an image gen smart field be valuable for your use case? It's something I've been considering building out here

I was thinking about image generation too, but to be honest I think at the moment I wouldn't personally use it for the following reasons:

Have a great week!