Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

gnsync exception: unexpected args type #136

@rhyc

Description

@rhyc

environment:
geeknote 3.1
ubuntu 20.04
python v3.8.10
venv

I get the following exception after running gnsync --path /my/path --format plain --all --download-only

2023-02-20 08:54:02,661 : Unexpected args type: <class 'bytes'>. Expect list or dict
Traceback (most recent call last):
  File "/home/myhome/myenv/lib/python3.8/site-packages/geeknote/gnsync.py", line 53, in wrapper
    return func(*args, **kwargs)
  File "/home/myhome/myenv/lib/python3.8/site-packages/geeknote/gnsync.py", line 500, in _get_notes
    tools.strip(self.notebook_name.encode("utf-8"))
  File "/home/myhome/myenv/lib/python3.8/site-packages/geeknote/tools.py", line 55, in strip
    raise Exception("Unexpected args type: " "%s. Expect list or dict" % type(data))
Exception: Unexpected args type: <class 'bytes'>. Expect list or dict

self.notebook_name is encoded into utf-8 byte streams before feeding into tools.strip, but tools.strip expects str instead of bytes.

After I add the following in tools.strip, gnsync seems to work now.

    if isinstance(data, bytes):
        data = data.decode('utf-8')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions