Skip to content
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

Having trouble importing epub #37

Open
nashihang777 opened this issue Nov 29, 2024 · 13 comments · Fixed by #63
Open

Having trouble importing epub #37

nashihang777 opened this issue Nov 29, 2024 · 13 comments · Fixed by #63
Labels
bug Something isn't working
Milestone

Comments

@nashihang777
Copy link

I encountered a "not exist" error when importing some epub files, while other epub files did not report an error. i don't konw why

image_1732698052951_0

@tvhong
Copy link
Owner

tvhong commented Dec 29, 2024

Do you have some example epub files that you can share? Ideally, at least 1 success and 1 failure file.

Also, it'd be great if you can share your Anki and addon versions. Go to About Anki > Copy Debug Info.

@nashihang777
Copy link
Author

nashihang777 commented Dec 30, 2024

Anki 24.11 (87ccd24e) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.19041

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Advanced Browser ['874215009', 2024-10-27T22:20, 'None', '']
AnkiConnect ['2055492159', 2024-11-07T09:34, 'None', mod]
Edit Field During Review Cloze ['385888438', 2024-11-16T18:23, '6.21', mod]
Enhanced Cloze for Anki 21 ['1990296174', 2023-09-11T02:48, 'None', '']
FSRS Helper Postpone Advance Load Balance Easy Days Disperse Siblings ['759844606', 2024-12-07T19:00, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T15:15, 'None', '']
Incremental Reading v4119 unofficial clone ['999215520', 2023-11-23T01:54, 'None', '']

===IDs of active AnkiWeb add-ons===
1374772155 1990296174 2055492159 385888438 759844606 874215009 999215520

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

epub.zip

@tvhong tvhong added the bug Something isn't working label Dec 30, 2024
@tvhong
Copy link
Owner

tvhong commented Dec 30, 2024

Thank you for providing the sample files!

I just tried to import all 3 of them in my Mac machine and they all succeeded. I suspect this might be something Windows specific.

Can you try accessing the file that were reported as "Not exists" and see if it's there?

I also see this part of the file name that doesn't exist in the file you sent me. What if you remove all special characters (e.g. (, ), .) in your epub file?
image

@nashihang777
Copy link
Author

nashihang777 commented Jan 1, 2025

I deleted the special characters in the file name and still got an error. In addition, those files that were reported as not existing do indeed exist in the directory indicated by the bug.
anki_bug
anki_bug2
anki_bug3
anki_bug4

@tvhong
Copy link
Owner

tvhong commented Jan 1, 2025

I just did some investigation and suspect that the addon was looking at the wrong drive (see how the path doesn't include a drive letter?).

Q: Does it successfully import a any articles/chapter in the failure file or did it just fail immediately?

@nashihang777
Copy link
Author

Perhaps you're right; the plugin might be making a mistake in path recognition. When I import the bug file, the plugin first provides a list of split chapters, but no matter what I select, it ultimately results in an error after I click confirm.

@tvhong
Copy link
Owner

tvhong commented Jan 6, 2025

Did any of the selected chapters get successfully imported?

@nashihang777
Copy link
Author

Never managed to successfully import the selected chapters; after the bug appeared, the entire Anki interaction interface froze, and I had to use the Windows Task Manager to close Anki. I carefully considered the path issue you mentioned and recalled that I had once changed my Win10 system's Documents directory from the C drive to the same path under a different drive letter. Perhaps this is the reason for the bug?

@tvhong
Copy link
Owner

tvhong commented Jan 6, 2025

Yeah, that could be related. I think this has something to do with the default drive that the add-on assumes, and the drive where the content of the epub is extracted. (related: On Windows, the directories C:\TEMP, C:\TMP, \TEMP, and \TMP, in that order.)

Also, the fact that you couldn't import any chapters means that the problem is likely at the folder level and not a per-file problem.

I have an idea for a fix that I can try in the next release. It might fix your problem (can't confirm as I can't reproduce).

tvhong added a commit that referenced this issue Jan 13, 2025
This is my attempt to fix #37

I can't reproduce the issue so just making a best guess.
@tvhong tvhong reopened this Jan 13, 2025
@tvhong tvhong added this to the 4.12.1 milestone Jan 13, 2025
@tvhong
Copy link
Owner

tvhong commented Jan 13, 2025

@nashihang777 I tried to fix this in 4.12.1. If you can try it out and let me know how it goes, that'd be appreciated!

@nashihang777
Copy link
Author

It's unfortunate that an error still occurred, and the error message is exactly the same as before. As a result, I can only close Anki through the Windows Task Manager.

Anki 24.11 (87ccd24e) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Windows-10-10.0.19041

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Advanced Browser ['874215009', 2024-10-27T22:20, 'None', '']
AnkiConnect ['2055492159', 2024-11-07T09:34, 'None', mod]
Edit Field During Review Cloze ['385888438', 2024-11-16T18:23, '6.21', mod]
Enhanced Cloze for Anki 21 ['1990296174', 2023-09-11T02:48, 'None', '']
FSRS Helper Postpone Advance Load Balance Easy Days Disperse Siblings ['759844606', 2025-01-10T15:28, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T15:15, 'None', '']
Incremental Reading v4121 unofficial clone ['999215520', 2025-01-14T05:27, 'None', '']

===IDs of active AnkiWeb add-ons===
1374772155 1990296174 2055492159 385888438 759844606 874215009 999215520

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

屏幕截图 2025-01-14 135027

@tvhong
Copy link
Owner

tvhong commented Jan 14, 2025

Hm.. how comfortable are you with using a terminal to launch Anki and make changes to Anki add-on code (or I can send you a zip file as well)?

I think I need some logs to debug this further.

@nashihang777
Copy link
Author

I can try to launch Anki from the terminal and send you the log. Do you have WeChat? It would make our communication more convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants