Ajatt-Tools/PasteImagesAsWebP

Error from Drag & Drop of .png file

problemadder opened this issue · 3 comments

Hey, thanks for sharing your add-on. I would love to use it. Sadly I have the following error on Mac.
Perhaps you have an idea?

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 on the add-on support site.
Debug info:
Anki 2.1.38 (355e4cd5) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-01-21 22:45:43
Add-ons possibly involved: ⁨Paste Images As WebP⁩

Caught exception:
Traceback (most recent call last):
File "", line 2, in dropEvent
File "anki/hooks.py", line 89, in decorator_wrapper
File "anki/hooks.py", line 86, in repl
File "/Users/XXXXX/Library/Application Support/Anki2/addons21/1151815987/init.py", line 76, in drop_event
w.convert(event.mimeData())
File "/Users/XXXXX/Library/Application Support/Anki2/addons21/1151815987/utils/webp.py", line 148, in convert
if self.toWebP(tmp_file, webp_filepath) is False:
File "/Users/XXXXX/Library/Application Support/Anki2/addons21/1151815987/utils/webp.py", line 122, in toWebP
p = subprocess.Popen(stringify_args(args),
File "subprocess.py", line 854, in init
File "subprocess.py", line 1702, in _execute_child
OSError: [Errno 8] Exec format error: '/Users/XXXXX/Library/Application Support/Anki2/addons21/1151815987/support/cwebp'

Hi! My guess is that the included binary is not compatible with MacOS. I'm going to include one and hopefully it won't crash anymore. For now you can run brew install webp, in theory it should solve the issue on your machine.

brew install webpdid not help. I even tried brew reinstall and I updated the add-on + restart of anki. The error message was still the same.
To solve the Problem I had to download the cwebp file from google and put it in the directory manually.
Thanks for your help and this gread addon.

Thank you for the clarification. I included the cwebp binary in the package. Now the addon should work on macOS out of the box.