Skip to content

BUG: config class "__repr__": not JSON serializable #282

Description

@HarryWangLaTrobe

In the class Config:

def __repr__(self):
        return json.dumps(Config._cfg)

However, this conflicts with:

    @property
    def bool_names(self):
        if "bool_names" in Config._cfg:
            names = Config._cfg["bool_names"]
        else:
            names = (b"FALSE", b"TRUE")  ## <-- this causes error
        return names

The byte type is not JSON serializable.

Therefore, the error is triggered each time when repr is called, e.g. print

This bug causes the dysfunction of h5pyd.get_config, e.g.
h5pyd.get_config( config_file= "./data/hsds.server.hscfg" )

suggested solution: either remove the byte data field or use the Python built-in True/False data type

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions