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

Too long file name #15

Closed
supukarmin opened this issue Mar 5, 2022 · 2 comments
Closed

Too long file name #15

supukarmin opened this issue Mar 5, 2022 · 2 comments

Comments

@supukarmin
Copy link

The single notes export crashes if the name of a note is too long. I suggest to shorten the name and write a warning / note to stdout. It would also be good if errors regarding to the file system could be fetched by default and handled with a warning / error.

evernote-backup export [HOME_DIR_PATH_REMOVED]evernote_export --single-notes

Reading database en_backup.db...
Exporting notes...
  [############------------------------]  2/6  Anderes                     
Traceback (most recent call last):
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/cli.py", line 282, in main
    cli()
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/cli.py", line 242, in export
    cli_app.export(
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/cli_app.py", line 147, in export
    exporter.export_notebooks(single_notes, include_trash, no_export_date)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/note_exporter.py", line 53, in export_notebooks
    self._export_active(single_notes, no_export_date)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/note_exporter.py", line 78, in _export_active
    self._export_notes(nb, single_notes, no_export_date)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/note_exporter.py", line 89, in _export_notes
    self._output_single_notes(parent_dir, notes_source, no_export_date)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/note_exporter.py", line 112, in _output_single_notes
    _write_export_file(note_path, note, no_export_date)
  File "[HOME_DIR_PATH_REMOVED].local/pipx/venvs/evernote-backup/lib/python3.8/site-packages/evernote_backup/note_exporter.py", line 129, in _write_export_file
    with open(file_path, "w", encoding="utf-8") as f:
OSError: [Errno 36] File name too long: '[VERY_LONG_NAME_REMOVED]'.enex'
@vzhd1701
Copy link
Owner

vzhd1701 commented Apr 5, 2022

Sorry, I cannot reproduce this issue. Could you share the note for testing? Also what evernote-backup version are you using and what is your OS?

@supukarmin
Copy link
Author

I deleted my Evernote account after exporting the notes. I can't also find the error itself anymore. It's gone. According to the bash history, I used these commands:

sudo apt install pipx python3.8-venv
pipx install evernote-backup --force
pipx ensurepath
pipx init-db
pipx sync
pipx export /evernote_export --single-notes

The machine was:

OS: Kubuntu 20.04.4 LTS
Kernel: Linux 5.13.0-39-generic
Architecture: x86-64
Python: 3.8.10
evernote-backup: 1.7.1
file system: ext4

Max title length in Evernote:
https://dev.evernote.com/doc/reference/Limits.html#Const_EDAM_NOTE_TITLE_LEN_MAX

EDAM_NOTE_TITLE_LEN_MAX i32 255
The maximum length of a Note.title, in Unicode characters

ext4 is 255 bytes. As far as I understood the Evernote docs, they're talking about characters. So as soon as you get a single character which takes more than 1 byte up, you should get an error. With normal latin chars, however, you should probably not get any problems, I guess.

@vzhd1701 vzhd1701 reopened this May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants