Pressing g/G to switch between color modes crashes the script.
Traceback (most recent call last):
File "./xterm-color-chooser", line 565, in <module>
while main(state):
File "./xterm-color-chooser", line 385, in main
line += "\033[49m" + state.fmt() + char*20 + "\033[mโ"
File "./xterm-color-chooser", line 304, in fmt
color = self.getcolor()
File "./xterm-color-chooser", line 213, in getcolor
return self["color"] + self["bright"]*8
KeyError: 'bright'
I suspect that this happens only on fresh new machine, as it may not have persistent state with bright
key.
Traceback (most recent call last):
File "./xterm-color-chooser", line 557, in <module>
state.load_persistent()
File "./xterm-color-chooser", line 102, in load_persistent
self.load(json.load(fh))
File "/usr/lib/python3.6/json/__init__.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The state loading mechanism needs some fail-safe.