vzhd1701 / enex2notion

Import Evernote ENEX files to Notion
MIT License
421 stars 34 forks source link

[Bug]: ERROR: Got 400 error attempting to POST to submitTransaction, with data #67

Closed rj03hou closed 1 year ago

rj03hou commented 1 year ago

enex2notion version

0.2.24

What OS are you using?

MacOS

OS Version / Linux distribution

MacOS 12.4

Bug description

when I import enex 2 notion, meet "ERROR: Got 400 error attempting to POST to submitTransaction, with data" using evernote-backup to export yinxiang. have try: evernote-backup export output_dir2 evernote-backup export --single-notes output_dir2

meet the same problem.

Log excerpt

INFO: 'Evernote ENEX Import' page found
INFO: Processing directory 'output_dir2'...
INFO: Processing notebook '001 ulimit.html'...
DEBUG: Parsing note '001 ulimit.html'
DEBUG: Unknown block: a, parsing as text
INFO: Uploading note 1 out of 1 '001 ulimit.html'
DEBUG: Creating new page for note '001 ulimit.html'
ERROR: Got 400 error attempting to POST to submitTransaction, with data: {
  "operations": [
    {
      "id": "294e6fc0-37b7-4ab3-8611-9a0effb70b44",
      "path": [],
      "args": {
        "id": "294e6fc0-37b7-4ab3-8611-9a0effb70b44",
        "version": 1,
        "alive": true,
        "created_by_id": "d6bc1550-f147-4138-88ad-f98a07421c7a",
        "created_by_table": "notion_user",
        "created_time": 1670300792858,
        "parent_id": "e5f23e47-e701-4468-a4bd-5917201dd8c6",
        "parent_table": "collection",
        "type": "page"
      },
      "command": "set",
      "table": "block"
    },
    {
      "args": {
        "last_edited_by_id": "d6bc1550-f147-4138-88ad-f98a07421c7a",
        "last_edited_by_table": "notion_user",
        "last_edited_time": 1670300792858
      },
      "command": "update",
      "id": "294e6fc0-37b7-4ab3-8611-9a0effb70b44",
      "path": [],
      "table": "block"
    },
    {
      "args": {
        "last_edited_by_id": "d6bc1550-f147-4138-88ad-f98a07421c7a",
        "last_edited_by_table": "notion_user",
        "last_edited_time": 1670300792858
      },
      "command": "update",
      "id": "294e6fc0-37b7-4ab3-8611-9a0effb70b44",
      "path": [],
      "table": "block"
    }
  ]
}
Traceback (most recent call last):
  File "/Users/houjunwei/.local/bin/enex2notion", line 8, in <module>
    sys.exit(main())
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/cli.py", line 32, in cli
    _process_input(enex_uploader, args.enex_input)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/cli.py", line 40, in _process_input
    enex_uploader.upload_notebook(enex_file)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/cli_upload.py", line 56, in upload_notebook
    self.upload_note(note, note_idx)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/cli_upload.py", line 79, in upload_note
    _upload_note(self.notebook_root, note, note_blocks)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/cli_upload.py", line 103, in _upload_note
    upload_note(notebook_root, note, note_blocks)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/enex_uploader.py", line 20, in upload_note
    new_page = _make_page(note, root)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/enex2notion/enex_uploader.py", line 59, in _make_page
    root.collection.add_row(
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/notion/collection.py", line 202, in add_row
    return self.add_row_block(columns=columns)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/notion/collection.py", line 213, in add_row_block
    row_id = self._client.create_record("block", self, type="page")
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/notion/client.py", line 427, in create_record
    self.submit_transaction(
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/notion/client.py", line 468, in __exit__
    self.client.submit_transaction(operations)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/notion/client.py", line 323, in submit_transaction
    self.post("submitTransaction", data)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/ratelimit/decorators.py", line 113, in wrapper
    return func(*args, **kargs)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
  File "/Users/houjunwei/.local/lib/python3.8/site-packages/notion/client.py", line 275, in post
    return self._post(endpoint, data)
  File "/Users/houjunwei/.local/lib/python3.8/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

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.

rj03hou commented 1 year ago

thank you very much. yes, the new version perfect resolve this problem.