diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index adad1dfa90..7d8091cc16 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -50,6 +50,9 @@ def to_json(obj): if hasattr(obj, 'toBase64'): # QByteArray return {'__class__': 'bytearray', '__value__': bytes(obj.toBase64()).decode('ascii')} + v = getattr(obj, 'value', None) + if isinstance(v, int): # Possibly an enum with integer values like all the Qt enums + return v raise TypeError(repr(obj) + ' is not JSON serializable')