enex2notion icon indicating copy to clipboard operation
enex2notion copied to clipboard

[Bug]: AttributeError: 'dict' object has no attribute 'encode'

Open chirul0 opened this issue 4 months ago • 3 comments

enex2notion version

0.3.1

What OS are you using?

MacOS

OS Version / Linux distribution

14.2.1

Bug description

AttributeError: 'dict' object has no attribute 'encode' error when running enex2notion with done-file

Log excerpt

Traceback (most recent call last):
  File "/opt/homebrew/bin/enex2notion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_3/libexec/lib/python3.12/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_3/libexec/lib/python3.12/site-packages/enex2notion/cli.py", line 32, in cli
    _process_input(enex_uploader, args.enex_input)
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_3/libexec/lib/python3.12/site-packages/enex2notion/cli.py", line 40, in _process_input
    enex_uploader.upload_notebook(enex_file)
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_3/libexec/lib/python3.12/site-packages/enex2notion/cli_upload.py", line 66, in upload_notebook
    self.upload_note(note, note_idx)
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_3/libexec/lib/python3.12/site-packages/enex2notion/cli_upload.py", line 69, in upload_note
    if note.note_hash in self.done_hashes:
       ^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_3/libexec/lib/python3.12/site-packages/enex2notion/enex_types.py", line 50, in note_hash
    s1_hash.update(h.encode("utf-8"))
                   ^^^^^^^^
AttributeError: 'dict' object has no attribute 'encode'

chirul0 avatar Feb 20 '24 15:02 chirul0

Looks like there was a minor upgrade to enex2notion to 0.3.1_4. Ran it again and still hitting the error:

Traceback (most recent call last):
  File "/opt/homebrew/bin/enex2notion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_4/libexec/lib/python3.12/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_4/libexec/lib/python3.12/site-packages/enex2notion/cli.py", line 32, in cli
    _process_input(enex_uploader, args.enex_input)
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_4/libexec/lib/python3.12/site-packages/enex2notion/cli.py", line 40, in _process_input
    enex_uploader.upload_notebook(enex_file)
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_4/libexec/lib/python3.12/site-packages/enex2notion/cli_upload.py", line 66, in upload_notebook
    self.upload_note(note, note_idx)
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_4/libexec/lib/python3.12/site-packages/enex2notion/cli_upload.py", line 69, in upload_note
    if note.note_hash in self.done_hashes:
       ^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/enex2notion/0.3.1_4/libexec/lib/python3.12/site-packages/enex2notion/enex_types.py", line 50, in note_hash
    s1_hash.update(h.encode("utf-8"))
                   ^^^^^^^^
AttributeError: 'dict' object has no attribute 'encode'

chirul0 avatar Feb 22 '24 17:02 chirul0

Tried w/ python3.11. Same error:

Traceback (most recent call last):
  File "enex2notion-venv/bin/enex2notion", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "enex2notion-venv/lib/python3.11/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "enex2notion-venv/lib/python3.11/site-packages/enex2notion/cli.py", line 32, in cli
    _process_input(enex_uploader, args.enex_input)
  File "enex2notion-venv/lib/python3.11/site-packages/enex2notion/cli.py", line 40, in _process_input
    enex_uploader.upload_notebook(enex_file)
  File "enex2notion-venv/lib/python3.11/site-packages/enex2notion/cli_upload.py", line 66, in upload_notebook
    self.upload_note(note, note_idx)
  File "enex2notion-venv/lib/python3.11/site-packages/enex2notion/cli_upload.py", line 69, in upload_note
    if note.note_hash in self.done_hashes:
       ^^^^^^^^^^^^^^
  File "enex2notion-venv/lib/python3.11/site-packages/enex2notion/enex_types.py", line 50, in note_hash
    s1_hash.update(h.encode("utf-8"))
                   ^^^^^^^^
AttributeError: 'dict' object has no attribute 'encode'

chirul0 avatar Feb 22 '24 17:02 chirul0

Same w/ python3.10:

Traceback (most recent call last):
  File "enex2notion-venv/bin/enex2notion", line 8, in <module>
    sys.exit(main())
  File "enex2notion-venv/lib/python3.10/site-packages/enex2notion/cli.py", line 47, in main
    cli(sys.argv[1:])
  File "enex2notion-venv/lib/python3.10/site-packages/enex2notion/cli.py", line 32, in cli
    _process_input(enex_uploader, args.enex_input)
  File "enex2notion-venv/lib/python3.10/site-packages/enex2notion/cli.py", line 40, in _process_input
    enex_uploader.upload_notebook(enex_file)
  File "enex2notion-venv/lib/python3.10/site-packages/enex2notion/cli_upload.py", line 66, in upload_notebook
    self.upload_note(note, note_idx)
  File "enex2notion-venv/lib/python3.10/site-packages/enex2notion/cli_upload.py", line 69, in upload_note
    if note.note_hash in self.done_hashes:
  File "enex2notion-venv/lib/python3.10/site-packages/enex2notion/enex_types.py", line 50, in note_hash
    s1_hash.update(h.encode("utf-8"))
AttributeError: 'dict' object has no attribute 'encode'

chirul0 avatar Feb 22 '24 18:02 chirul0