HDFGroup / HDFGroup/h5pyd

BUG: config class "__repr__": not JSON serializable

Open
#282 0 comments 0 reactions 1 assignee Claimed by @jreadey View on GitHub
Dominant language
Python
Stars
124
Forks
46
Avg merge
1h 24m
Merged PRs (30d)
6

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.