Skip to content

Some examples in the documentation don't work with Python 3 #773

@rutsky

Description

@rutsky

For example this one:

>>> from docker import Client
>>> cli = Client(base_url='tcp://127.0.0.1:2375')
>>> for line in cli.pull('busybox', stream=True):
...     print(json.dumps(json.loads(line), indent=4))

will produce:

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

Maybe explicitly document such differences, e.g. by adding something like "Note: On Python 3 you need to decode line from bytes to str: json.loads(line.decode())"?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions