Skip to content

[Bug]: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #77

@wycmiko

Description

@wycmiko

enex2notion version

0.2.25

What OS are you using?

MacOS

OS Version / Linux distribution

13.2.1 (22D68) Ventura

Bug description

I used evernote-backup to export my notes(Chinese Evernote 印象笔记) with *.enex files, but I
failed to run command enex2notion --done-file ./done.txt --token xxx-xxx ./ 2>&1 |tee log.txt,
got jsonParseException,

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/bin/enex2notion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/cli.py", line 26, in cli
    root = get_root(args.token, args.root_page)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/cli_notion.py", line 21, in get_root
    client = get_notion_client(token)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/cli_notion.py", line 31, in get_notion_client
    return NotionClient(token_v2=token)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/notion/client.py", line 113, in __init__
    self._update_user_info()
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/notion/client.py", line 144, in _update_user_info
    records = self.post("loadUserContent", {}).json()["recordMap"]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Log excerpt

DEBUG: Parsing note 'open-03(for youdao 12)'
DEBUG: Parsing note 'open-03(for youdao 13)'
DEBUG: Parsing note 'open-03(for youdao 14)'
DEBUG: Parsing note 'open-03(for youdao 15)'
DEBUG: Parsing note 'open-03(for youdao 16)'
DEBUG: Parsing note '01'
DEBUG: Parsing note 'liulishuo1'
DEBUG: Parsing note 'liulishuo1'
DEBUG: Parsing note 'liulishuo2'
INFO: Processing notebook 'learning'...
DEBUG: Parsing note 'Untitled'
ERROR: Failed to parse note 'Untitled'
DEBUG: list index out of range
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/cli_upload.py", line 84, in _parse_note
    return parse_note(note, self.rules)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/note_parser/note.py", line 18, in parse_note
    note_dom = _parse_note_dom(note)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/note_parser/note.py", line 47, in _parse_note_dom
    return _filter_yinxiang_markdown(note_dom)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.2.25/libexec/lib/python3.11/site-packages/enex2notion/note_parser/note.py", line 51, in _filter_yinxiang_markdown
    last_block = note_dom.contents[-1]
                 ~~~~~~~~~~~~~~~~~^^^^
IndexError: list index out of range
DEBUG: Skipping note 'Untitled' (no blocks)
DEBUG: Parsing note 'Conda'
DEBUG: Parsing note 'Mlflow'
DEBUG: Parsing note '由于'
DEBUG: Parsing note 'Untitled'
DEBUG: Parsing note 'Wiki Page & tickets'

some of them have Chinese folder names, and --verbose will get
IndexError: list index out of range

could you please help to check it? thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions