Skip to content

Intro-dnac module: unsupported format string passed to NoneType.__format__ #70

@JPedro2

Description

@JPedro2

dnac-nbapi-hello-world.py
It looks like there are a few None values which will not be printed - I'm assuming this is due to the new devices added to the DNAC Always-on Sandbox.

To fix the issue I would suggest to explicitly convert the values to a string object by using !s, which translates into modifying line 105, so the code block would look as follows:

for device in response['response']:
        uptime = "N/A" if device['upTime'] is None else device['upTime']
        print("{0!s:42s}{1!s:17s}{2!s:17s}{3!s:18s}{4!s:12s}{5!s:16s}{6!s:15s}".
            format(device['hostname'],
                    device['managementIpAddress'],
                    device['serialNumber'],
                    device['platformId'],
                    device['softwareVersion'],
                    device['role'],uptime))

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