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]: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #77

Open
wycmiko opened this issue Mar 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@wycmiko
Copy link

wycmiko commented Mar 23, 2023

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

@wycmiko wycmiko added the bug Something isn't working label Mar 23, 2023
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

1 participant