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

Snapshot <class 'OSError'>: [WinError 123] 文件名、目录名或卷标语法不正确 #44

Closed
L-M-Sherlock opened this issue Mar 29, 2019 · 6 comments

Comments

@L-M-Sherlock
Copy link
Contributor

In my option, it results from the name of deck including '\n', but it is hard to find the '\n', because it is invisible. You can filter it when building the file.
I'm a chinese student, and my English is poor, so I paste the English Error code.

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-ons section of our support site.
Debug info:
Anki 2.1.11 (3cf770c7) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
File "aqt\main.py", line 172, in onOpenProfile
File "aqt\main.py", line 263, in loadProfile
File "anki\hooks.py", line 29, in runHook
File "C:\Users\L.M.Sherlock\AppData\Roaming\Anki2\addons21\1788670778\history\archiver_vendor.py", line 42, in snapshot_on_sync
self.do_snapshot('CrowdAnki: Snapshot on sync')
File "C:\Users\L.M.Sherlock\AppData\Roaming\Anki2\addons21\1788670778\history\archiver_vendor.py", line 47, in do_snapshot
reason=reason)
File "C:\Users\L.M.Sherlock\AppData\Roaming\Anki2\addons21\1788670778\history\archiver.py", line 23, in archive
self.deck_archiver_supplier(deck).archive(reason=reason)
File "C:\Users\L.M.Sherlock\AppData\Roaming\Anki2\addons21\1788670778\history\anki_deck_archiver.py", line 19, in archive
deck_path = self.deck_exporter.export_to_directory(self.deck, self.output_directory)
File "C:\Users\L.M.Sherlock\AppData\Roaming\Anki2\addons21\1788670778\export\anki_exporter.py", line 26, in export_to_directory
deck_directory.mkdir(parents=True, exist_ok=True)
File "pathlib.py", line 1257, in mkdir
File "pathlib.py", line 1348, in is_dir
File "pathlib.py", line 1158, in stat
File "pathlib.py", line 387, in wrapped
<class 'OSError'>: [WinError 123] 文件名、目录名或卷标语法不正确。: 'C:\Users\L.M.Sherlock\AppData\Roaming\Anki2\addons21\1788670778\user_files\整合\3_生物组__1_必修一__1-5细胞的分化、衰老和凋亡__(2)细胞的全能性\n'

@Stvad
Copy link
Owner

Stvad commented Apr 6, 2019

Hmm, have you tried renaming the deck to confirm your hunch about \n?

@L-M-Sherlock
Copy link
Contributor Author

L-M-Sherlock commented Apr 7, 2019

Hmm, have you tried renaming the deck to confirm your hunch about \n?

yes, when I rename those decks, I find the invisible blank in the end of every deck's name. And I remove it from those decks where the error occurded. After that, there is no problem. And I find when you edit the name of deck, pressing Enter means saving the name. It is hard to know why the '\n' existed in my deck's name, but I reproduce the case. I copy a string
201904071021
from the 8th row to the 7th row, the '\n' will be copied too. when I paste it as the name of deck and build a snapshot, the error occured again.

@Stvad
Copy link
Owner

Stvad commented Apr 7, 2019

seems to be a windows specific problem 🤔

@Stvad
Copy link
Owner

Stvad commented Apr 7, 2019

I've updated the sanitizer, so this should be fixed in the next version I publish.
In the meantime can you please check one more thing: would it fail if the \n symbol is in the middle of the name and not at the end?

@L-M-Sherlock
Copy link
Contributor Author

I've updated the sanitizer, so this should be fixed in the next version I publish.
In the meantime can you please check one more thing: would it fail if the \n symbol is in the middle of the name and not at the end?

I have tested it just now, and the same error occured again.

@Stvad
Copy link
Owner

Stvad commented Apr 10, 2019

Fixed in v0.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants