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

[Bug]: Error exporting notes #38

Closed
twobaker opened this issue Apr 26, 2023 · 4 comments
Closed

[Bug]: Error exporting notes #38

twobaker opened this issue Apr 26, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@twobaker
Copy link

evernote-backup version

1.9.2

What OS are you using?

Windows

OS Version / Linux distribution

Windows 10

Bug description

Sync and auth works fine, but exporting notes give an error. Allways same notebook (8 from 91), no matter if single export or notebook export.

Log excerpt

(--verbose doesn't work), but in screen
Reading database en_backup.db...
Exporting notes...
  [###---------------------------------]  8/91  00:12:29
Traceback (most recent call last):
  File "evernote_backup\cli.py", line 305, in main
  File "click\core.py", line 1130, in __call__
  File "click\core.py", line 1055, in main
  File "click\core.py", line 1657, in invoke
  File "click\core.py", line 1404, in invoke
  File "click\core.py", line 760, in invoke
  File "evernote_backup\cli.py", line 260, in export
  File "evernote_backup\cli_app.py", line 160, in export
  File "evernote_backup\note_exporter.py", line 64, in export_notebooks
  File "evernote_backup\note_exporter.py", line 88, in _export_active
  File "evernote_backup\note_exporter.py", line 99, in _export_notes
  File "evernote_backup\note_exporter.py", line 122, in _output_notebook
  File "evernote_backup\note_exporter.py", line 154, in _write_export_file
  File "evernote_backup\note_formatter.py", line 25, in format_note
  File "evernote_backup\note_formatter_util.py", line 14, in fmt_time
OSError: [Errno 22] Invalid argument
@twobaker twobaker added the bug Something isn't working label Apr 26, 2023
@Houska1
Copy link
Contributor

Houska1 commented Aug 9, 2023

I had the exact same problem right now. The culprit in my case was a single note whose creation date, as reported within EN 10, was Tuesday, 16 Dec 1969, 04:29. This is clearly erroneous and some glitch in the EN database itself. Nevertheless, evernote-backup needs to handle bad creation (and other(?)) dates more gracefully. According to https://docs.python.org/3/library/datetime.html#datetime-objects, need to expect OverflowError or OSError for dates prior to 1970.

In my case, this one note was no longer useful, so I deleted it and expunged it from Trash in EN itself. Then, after a sync to capture that change, exporting worked normally.

Thanks for a great tool!

Editing to add: I've kept an Evernote-Legacy exported .enex of the faulty note if helpful, but the only remarkable thing about it is the clearly corrupt <created>19691216T092941Z</created> which is what makes fmt_time, line 14 choke.

@Houska1
Copy link
Contributor

Houska1 commented Aug 9, 2023

I'm not running on a machine where I can try changing python code, but perhaps this special case, which is erroneous data within EN itself, could be simply caught with a try: ... except: return None in fmt_time in note_formatter_util.py? This would match the None returned by if timestamp is None: return timestamp on line 8.

favoyang added a commit to favoyang/evernote-backup that referenced this issue Sep 10, 2023
@favoyang
Copy link
Contributor

It may be caused by an invalid timestamp (for me it's a negative timestamp). I fixed it in PR #48.

Alternatively, you can try...catch the OSError and simply ignore all cases.

@sergeevabc
Copy link

sergeevabc commented Jan 15, 2024

Windows 7 x64, evernote-backup 1.9.3

$ evernote-backup
Usage: evernote-backup.exe [OPTIONS] COMMAND [ARGS]...
Try 'evernote-backup.exe --help' for help.

$ evernote-backup --single-notes export ./myfiles
Error: No such option: --single-notes

$ evernote-backup export --single-notes ./myfiles
Reading database en_backup.db...
Exporting notebooks...
  [#################-------------------]  9/19  00:00:12
Traceback (most recent call last):
  File "evernote_backup\cli.py", line 305, in main
  File "click\core.py", line 1157, in __call__
  File "click\core.py", line 1078, in main
  File "click\core.py", line 1688, in invoke
  File "click\core.py", line 1434, in invoke
  File "click\core.py", line 783, in invoke
  File "evernote_backup\cli.py", line 260, in export
  File "evernote_backup\cli_app.py", line 160, in export
  File "evernote_backup\note_exporter.py", line 64, in export_notebooks
  File "evernote_backup\note_exporter.py", line 88, in _export_active
  File "evernote_backup\note_exporter.py", line 97, in _export_notes
  File "evernote_backup\note_exporter.py", line 115, in _output_single_notes
  File "evernote_backup\note_exporter.py", line 128, in _write_export_file
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\...\\myfiles\\loooooong.enex'

Two failures here:

  • help should say COMMAND [OPTIONS] instead of [OPTIONS] COMMAND
  • no strategy for long file names

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

No branches or pull requests

4 participants