-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnkiConnect doesn't export cards #44
Comments
Are you sure there isn't an XHR call at all? I'm looking at the code and I can see I don't have good enough error handling here yet so it's understandable why it's saying things "Congrats, you're done!", but it looks like it should be doing some XHR call to Thank you for reporting this issue by the way! Edit: Also, have you tried selecting a different or new deck? |
I deployed additional error handling. Now if an error occurs it should show the error in a toast and it won't say "Congrats, you're done!". I also realized I didn't have anything preventing someone from trying to import cards when a deck hadn't been selected. That would cause things to break with a javascript error before doing any XHR like you're seeing. Let me know if this fixes your issue! |
Sorry. I expressed myself badly. There was XHR calls, both to check the Decks name and IDs, and to add the new cards, with all the data required, but the POST headers are always 200. And yes, the url is the same, and I created a new deck, tried to insert in a nested deck... No luck. Tried again. Now with the Yomichan's Anki Integration turned off and... No luck. No card is getting added. Even the sync button on Anki that becomes blue as soon as the Anki detects a new change isn't turning blue. It's like the card not even reach to Anki. And, as I said, there is no error, neither from the CR nor from Anki. |
What was in the response to the xhr to add the cards?
As far as I remember Anki-Connect will always respond with a 200. The response changes if there's an error, but the http status will always be 200. If there's an error the response will be something like |
|
Hmm, that is weird. It should normally be an array of numbers, not a null. Out of curiosity do you happen to have the Browse window up? I'm seeing some similar sounding issues that mention that having the Browse window open would clear changes. Could you post the Japanese phrase you're using, what word you're highlighting, and the name of the Anki deck you're trying to add it to? I wonder if there are some specific issues with deck names that I'm not aware of. |
No. I just open the window to see if the cards are added, a few seconds after adding them through the CR.
勝者という概念がある以上敗者は同じくして存在する。
存在 (both "Dictionary" and "In Context" formats. Edit: Not at the same time. I try with one then proceed to refresh and try with the other.)
Tango N5+N4::CR Mining (tested with a new deck called "test" and Default, neither works.) |
Hmm, I'm kind of unsure what else to check, I tried all of those and it all worked for me. If you go to the plugins menu in Anki, then click Anki-Conect and click "Config" can you comment with the JSON that shows up? For reference mine looks like this: {
"apiKey": null,
"apiLogPath": null,
"ignoreOriginList": [],
"webBindAddress": "127.0.0.1",
"webBindPort": 8765,
"webCorsOriginList": [
"http://localhost",
"https://context.reviews"
]
} Also, what OS are you using? I've tried this on Linux (Fedora) and Windows and both work for me. |
{
"apiKey": null,
"apiLogPath": null,
"webBindAddress": "127.0.0.1",
"webBindPort": 8765,
"webCorsOriginList": ["http://localhost", "https://context.reviews"],
"ignoreOriginList": []
}
Windows 10 Home Single Language 21H2. Two details: |
Hmm, that all looks fine. Can you try launching Anki from the command line and see if there are any Anki-Connect logs when you hit "Add to Deck" that show up and look alarming? I'm seeing some deprecation notices, but no errors. Maybe you're seeing an error? |
Actually, before you do that, can you edit some of Anki-Connect's python script? Find the main script for Anki-Connect, which I believe should be in
print('addNotes exception')
traceback.print_exc() Remember it's python and whitespace matters so those two lines need to be indented to the same level as Then launch Anki from the command line and see what errors are getting logged when you add cards from Context.Reviews. I have a hunch there's some error that's being encountered and Anki-Connect is just ignoring it. That looks like the only way you'd be seeing |
Bingo.
After changing the Card Type "Básico" (in portuguese) to "Basic", got the following exception:
Then, after some searching, I came across this issue on AnkiConnect's repo. Then I thought about that may be something related to Anki's localization again, as changing the name of the Card Type solved the first issue, so I went to change the fields name as well. And... Whoa. Who could imagine that this silent error would be related to Card Type's name and fields localization, huh? Thanks a lot for your support! |
Oh wow, I didn't realize thank Anki localized the card names and field names, that sounds very error prone! Thanks for helping me investigate this, and thanks for your investigation! So everything is working for you now? If so I'll close this issue. In the future I want to make a custom card type for Context.Reviews for efficiency, and that'll probably fix this issue so now I have another reason to do that! |
Expecting there to be an existing card model called "Basic" with "Front" and "Back" fields lead to problems. Those names are all localized in other languages which leads to cards silently not being created. To get around that before adding the notes it will check to see if a "Context.Reviews v1" card model exists, and if it doesn't it will create it. The card model is mostly the same as the "Basic" model, except that the CSS has been extracted and now exists on the model itself. This has some extra benefits: 1. less duplicated data between cards, 2. night mode on AnkiDroid works! AnkiDroid's night mode will try and invert colors on cards unless the card model includes a `night-mode` class in its css. It unfortunately doesn't look at css in the Front field of the card, but it will look at the model so that's not an issue anymore because we're not using Basic anymore. The html still has a lot of duplication between cards, but that can be improved with a version 2 of the card model along with other features I want to add. The code is set up so the SRSConstructor just has to return a different model name (e.g. "Context.Reviews v2") and it will create that if needed, so further changes to the model only needs to change SRSConstructor. The CSS still needs to exist sometimes, so it will be included in all previews on the site, and when exporting the manual text file.
Could you change your Basic card type name back to "Básico", and then try to create cards through Context.Reviews/Anki-Connect again and see if it works? (Remember to refresh the page first if it's open still) Context.Reviews should now create a |
Everything is working fine! Thanks! |
Nice! Thanks for helping debug this issue! |
Expected Behavior
The created cards should be automatically imported to Anki.
Current Behavior
Nothing happens. Not even an error is threw.
Possible Solution
Without any errors, it may be hard to debug. Although I think it's related to the AnkiConnect plugin.
Steps to Reproduce
Context (Environment)
Chrome 98.0.4758.81 64 bits.
Anki 2.1.49 (dc80804a)
AnkiConnect Lastest Version as from 2021-12-27.
The text was updated successfully, but these errors were encountered: