Skip to content

JSON object must be str, not 'bytes' error when using python3 #297

Description

@chinyeungli
ERROR: the JSON object must be str, not 'bytes'

I have the above error when using Python 3 in gen to fetch license.

After some investigation, it seems the problem is at
https://github.com/nexB/aboutcode-toolkit/blob/280-python3-cleanup/src/attributecode/api.py#L66

response_content = response.read()

The fix is likely this: https://stackoverflow.com/a/32250010
i.e.

response_content = response.read().decode('utf-8')

However, I'll like to have your input on this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions