vzhd1701 / enex2notion

Import Evernote ENEX files to Notion
MIT License
424 stars 35 forks source link

[Bug]: #68

Closed sharonsylu closed 1 year ago

sharonsylu commented 1 year ago

enex2notion version

enex2notion 0.2.24

What OS are you using?

MacOS

OS Version / Linux distribution

Ventura 13.0.1

Bug description

Hello,

This seems to be related to #67 - meaning, it starts with the same 400 error, but with a different error thrown at the end:

requests.exceptions.HTTPError: Unsaved transactions: SpaceShardRecordPointer have no space id

Things I have tried:

Very grateful for any suggestions you might have. Thank you for creating enex2notion!

Log excerpt

INFO: 'Evernote ENEX Import' page found
INFO: Processing notebook 'startups'...
INFO: Uploading note 1 out of 17 '#AAA What Every Startup Needs to Know'
ERROR: Got 400 error attempting to POST to submitTransaction, with data: {
  "operations": [
    {
      "id": "573315a1-e65b-47d0-bb43-00a16388b356",
      "path": [],
      "args": {
        "id": "573315a1-e65b-47d0-bb43-00a16388b356",
        "version": 1,
        "alive": true,
        "created_by_id": "fe3731c3-b03e-4da0-8e0e-79b2ad01ec4c",
        "created_by_table": "notion_user",
        "created_time": 1670302128753,
        "parent_id": "4b5b3562-c2fe-4316-95f3-0a0e784e5860",
        "parent_table": "collection",
        "type": "page"
      },
      "command": "set",
      "table": "block"
    },
    {
      "args": {
        "last_edited_by_id": "fe3731c3-b03e-4da0-8e0e-79b2ad01ec4c",
        "last_edited_by_table": "notion_user",
        "last_edited_time": 1670302128753
      },
      "command": "update",
      "id": "573315a1-e65b-47d0-bb43-00a16388b356",
      "path": [],
      "table": "block"
    },
    {
      "args": {
        "last_edited_by_id": "fe3731c3-b03e-4da0-8e0e-79b2ad01ec4c",
        "last_edited_by_table": "notion_user",
        "last_edited_time": 1670302128753
      },
      "command": "update",
      "id": "573315a1-e65b-47d0-bb43-00a16388b356",
      "path": [],
      "table": "block"
    }
  ]
}
Traceback (most recent call last):
  File "/opt/homebrew/bin/enex2notion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/cli.py", line 32, in cli
    _process_input(enex_uploader, args.enex_input)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/cli.py", line 42, in _process_input
    enex_uploader.upload_notebook(path)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/cli_upload.py", line 56, in upload_notebook
    self.upload_note(note, note_idx)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/cli_upload.py", line 79, in upload_note
    _upload_note(self.notebook_root, note, note_blocks)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/cli_upload.py", line 103, in _upload_note
    upload_note(notebook_root, note, note_blocks)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/enex_uploader.py", line 20, in upload_note
    new_page = _make_page(note, root)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/enex2notion/enex_uploader.py", line 59, in _make_page
    root.collection.add_row(
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/collection.py", line 202, in add_row
    return self.add_row_block(columns=columns)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/collection.py", line 213, in add_row_block
    row_id = self._client.create_record("block", self, type="page")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/client.py", line 416, in create_record
    with self.as_atomic_transaction():
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/client.py", line 468, in __exit__
    self.client.submit_transaction(operations)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/client.py", line 323, in submit_transaction
    self.post("submitTransaction", data)
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/ratelimit/decorators.py", line 113, in wrapper
    return func(*args, **kargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/client.py", line 275, in post
    return self._post(endpoint, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.24/libexec/lib/python3.11/site-packages/notion/client.py", line 290, in _post
    raise HTTPError(
requests.exceptions.HTTPError: Unsaved transactions: SpaceShardRecordPointer have no space id
vzhd1701 commented 1 year ago

Seems like notion API changed, working on the fix now.

vzhd1701 commented 1 year ago

Should be fixed now. Check out the new version (0.2.25). Available via pypi and standalone binary for now. Homebrew will be updated in a few hours.

SchroedersKater commented 1 year ago

Thank you very much! I was just looking here because of the same problem and it's solved already. Great!

BTW, when I upload my files I get the advice "enex2notion: error: unrecognized arguments: -B -S -E -s -c", but didn't use any of these arguments. Could you please advise?

Thank you very much for this great software! I wish there was one like this for enex2onenote as well.

Greetings from Germany Thomas

vzhd1701 commented 1 year ago

@SchroedersKater Can you show me full command (excluding token) that you use to run enex2notion?

SchroedersKater commented 1 year ago

Sure, I used these 2 commands:

- ./enex2notion --token ed...14 "Entwicklung & Software-Notizen.enex"
- ./enex2notion --token ed...14 --mode PAGE --mode-webclips PDF --add-pdf-preview --add-meta --condense-lines-sparse "- INBOX.enex"

HTH

vzhd1701 commented 1 year ago

I don't see anything wrong here. What OS and command interpreter do you use?

SchroedersKater commented 1 year ago

Some more information what the terminal (macOS Ventura, Intel) looks like:

INFO: 'Evernote ENEX Import' page found
INFO: Processing notebook '- INBOX'...
ERROR: Failed to parse note 'Unbenannte Notiz'
INFO: Uploading note 2 out of 7 'Zu erledigende Dinge'
  0%|                                                  | 0/2 [00:00<?, ?block/s]usage: enex2notion [-h] [--token TOKEN] [OPTION ...] FILE/DIR [FILE/DIR ...]
enex2notion: error: unrecognized arguments: -B -S -E -s -c
INFO: Uploading note 3 out of 7 'Von VHS-C und MiniDV kopierte Videos'          
INFO: Uploading note 4 out of 7 'Spotify - Gutschein für 1 Jahr'                
INFO: Uploading note 5 out of 7 'Fwd: VIP-Alarm: Black-Friday-Vorverkauf, mit bis zu 70% Rabatt!'
INFO: Uploading note 6 out of 7 'Merkblatt zu den förderfähigen Kosten Heizen mit Erneuerbaren Energien'
INFO: Uploading note 7 out of 7 'Baumarkt - Euro-Mehrfachsteckdose'             
multiprocessing/resource_tracker.py:96: UserWarning: resource_tracker: process died unexpectedly, relaunching.  Some resources might leak.
Thomas'iMac:Downloads entwicklung$ usage: enex2notion [-h] [--token TOKEN] [OPTION ...] FILE/DIR [FILE/DIR ...]
enex2notion: error: unrecognized arguments: -B -S -E -s -c

Additionally the program doesn't seem to stop after the last error message.

SchroedersKater commented 1 year ago

Python 3.9.6 (default, Sep 26 2022, 11:37:49) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin

3,3 GHz 6-Core Intel Core i5 macOS Ventura 13.0.1 (22A400)

vzhd1701 commented 1 year ago

enex2notion doesn't use any multiprocessing stuff, but according to your log it tries to create a subprocess which gives you unrecognized arguments error. How do you install enex2notion?

SchroedersKater commented 1 year ago

I just downloaded the app and executed it from my download directory.

vzhd1701 commented 1 year ago

There is something wrong with standalone binary for Mac. I would suggest installing enex2notion using Homebrew for now.

vzhd1701 commented 1 year ago

I have rebuilt standalone binary for Mac. Please re-download it and tell me how it works for you now.

SchroedersKater commented 1 year ago

Looks very good now. Thank you!

SchroedersKater commented 1 year ago

One more question: Is there a way to increase the speed? My upload channel is barely used.

vzhd1701 commented 1 year ago

You can run multiple enex2notion instances in parallel, one per notebook for example.

SchroedersKater commented 1 year ago

Thanks, good idea.

mbdiener commented 1 year ago

Thank you for this latest fix! I had logged in here to submit this issue and found that you had already fixed it. Your software has been a lifesaver for my wholesale transfer of 1000s of Evernote notes to Notion after 12 years of using EV.

sharonsylu commented 1 year ago

Have rerun, and can confirm the new release resolved the issue after Notion changed their API!

Thankyou for pushing out a fix so fast across all platforms. Could not believe you replied to me within 4 minutes of logging this issue, and got to work immediately to rebuild with an update in 5 hrs, wow!

I am so grateful to have stumbled across Enex2notion, could not bear to spend a whole year manually copy-pasting 1000s notes. This is an awesome tool with such clear documentation, thank you for sharing with the world Vlad!


macOS Ventura 13.0.1 (22A400) Darwin Kernel Version 22.1.0 2021 M1 Pro 16GB Cheers from Sydney :)