Closed TowelSniffer closed 3 years ago
This is the intended behavior. The user script now loads the closet script asynchronously, which you can see here:
https://github.com/hgiesel/closet/blob/8e231ea73e27b2a626f89c0d5bdea7ed1db05cd6/anki/web/user.js#L9)
Concerning the script in Asset Manager: If you open it, you should see, that it says "loose". You can safely delete it, as it is no longer necessary.
Additionally, the Anki Persistence is no longer a requirement for Closet to work, as I incorporated the logic into the Closet main code.
This increases performance a lot, where as before basically it continuously waited 100ms to check whether the closet script loaded.
Hi, where i'm getting confused is I'm getting this error which I can see using AnkiWebView Inspector.
Hm, weird.
Can you try typing import('./__closet.js')
or import('/__closet.js')
into the inspector.
Also, what platform are you on?
At this point, I'm thinking of rolling back the update...
The error occurs on windows, and my cards don't work on android either.
I just uploaded a new version, could you try updating it?
And in case it still does not work, could you look into the media folder of your Anki collection (called collection.media
), and check for the file __closet.js
?
I tried and I still seem to get the same error, and the file is in my media folder.
Okay, I don't really know how to go from here.
Next week I'll have a Windows computer to make Windows-specific debugging. In the mean time, I can offer you to keep using the old version. Download this zip, rename the file from .zip
to .ankiaddon
(GitHub doesn't allow uploading files with file endings it doesn't know), and install it.
You can safely uninstall Closet For Anki
and install this version instead, without loosing data.
Hey man thank you for this. I feel like I'm overlooking something if you can't replicate this because issue as it happens on all my devices including ankidroid.
Maybe a last thing you could try (in case you haven't changed back yet) is to execute:
fetch('./__closet.js').then(response => response.blob()).then(console.log)
What I get as a result is Blob {size: 93267, type: "application/javascript"}
.
yeah so I'm getting Blob {size: 93267, type: "text/plain"}
for that
Ok, so this solves this mystery: for some reason the webview in Anki on Windows doesn't recognize the file ending in .js
as a javascript file, but rather as "plain text" file.
There's nothing you can do here, but also nothing that I can do. This is actually a bug in Anki.... I'll have to send a PR to Anki itself to fix it. However if it doesn't work on AnkiDroid either, they'd also have to fix it.
Hi, it seems like I have this same issue. Is there any workaround for now? Thank you.
Okay, I don't really know how to go from here. Next week I'll have a Windows computer to make Windows-specific debugging. In the mean time, I can offer you to keep using the old version. Download this zip, rename the file from
.zip
to.ankiaddon
(GitHub doesn't allow uploading files with file endings it doesn't know), and install it.You can safely uninstall
Closet For Anki
and install this version instead, without loosing data.
The workaround is downloading the old version in that link
Thank you. after installing, I do run into a problem when try to "Write to template" in Asset manager. Is there any step I need to do? Following is the debug info.
Debug info: Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2 Platform: Windows 10 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2020-11-10 22:04:25
Caught exception: Traceback (most recent call last): File "C:\Users\david\AppData\Roaming\Anki2\addons21\656021484\gui_config\config.py", line 56, in writeBackCurrentSetting write_media(self.modelId, script_data) File "C:\Users\david\AppData\Roaming\Anki2\addons21\656021484\src\media_writer.py", line 25, in write_media mw.col.media.write_data(script[0], script[1].encode()) File "anki\media.py", line 108, in write_data File "anki\rsbackend_gen.py", line 197, in add_media_file File "anki\rsbackend.py", line 267, in _run_command anki.rsbackend.IOError: IOError { info: "Os { code: 3, kind: NotFound, message: \"The system cannot find the path specified.\" }" }
I'm not the addon author so i'm not sure with bug fixing but that link works for me, Have you deleted the other closet version so that you dont have two installed?
yes I deleted the web-installed one and then install from this link and I get this error.
Hey @lonelyspirit , it seems at some point I was unsubscribed from this thread, which is why I didn't get a notification!
Go into the Asset Manager menu, and make sure, that all of the list items have "Into Template" as their Insertion Position. This should fix it.
Thank you @hgiesel , the error disappeared. However, it still cant get closet to work. Not sure how to troubleshoot this. If it is too much of work, maybe I just have to wait and see if the original problem with the .js file is fix. Thank you.
Sure. This problem should already be fixable in the next Anki version, which is already in its second beta. Then we can try again.
This is kind of work-around should be no longer necessary since Anki 2.1.36
after the latest update, only the closet setup script seems to be loaded by asset manager, not the closet script itself.