Skip to content

Type error caused by json.loads(pkg_resources.resource_string) #16

@binweg

Description

@binweg

I experience the following issue when importing plotly on Python 3 (3.3.0 on Windows, 3.4.0 on Linux). I haven't checked whether the error occurs on Python 2

plotly/graph_objs/graph_objs.py (in 4ed359e and maybe before) at lines 42ff cause a type error in the json module's loads function:

INFO = json.loads(resource_string('plotly',
                                  'graph_reference/graph_objs_meta.json')
                  object_pairs_hook=collections.OrderedDict)

TypeError: the JSON object must be str, not 'bytes'

Manually decoding the byte string with an added .decode('utf-8') solved my problems, but I'm not sure whether this will cause problems on Python 2 – I.e. I'm not aware of whether the return type of resource_string is different then.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions