Ubuntu 22.10's upgrade to 1.1.5 broke stuff. ("'NoneType' object is not iterable") w/fix
Created by: fat-tire
Hey fwiw in Ubuntu 22.10 (beta), I just got an upgrade of solaar from 1.1.1 to 1.1.5 (solaar_1.1.5+dfsg-1_all.deb) and noticed that solaar was now broken. Running it manually resulted in an error that ended like this:
....
File "/usr/share/solaar/lib/logitech_receiver/device.py", line 352, in persister
self._persister = _configuration.persister(self)
File "/usr/share/solaar/lib/solaar/configuration.py", line 214, in persister
_load()
File "/usr/share/solaar/lib/solaar/configuration.py", line 71, in _load
_config = _cleanup_load(loaded_config)
File "/usr/share/solaar/lib/solaar/configuration.py", line 137, in _cleanup_load
for element in c:
TypeError: 'NoneType' object is not iterable
This was running as the user (not rute) and seemed to be an issue parsing the ~/.config/solaar/config.yaml
file. When I looked at that file, it was completely blank, though there was a file there config.json
modified five months back that looked like this:
{
"_version": "1.1.1"
}
On a hunch, I set the blank config.yaml
to instead look like:
_version:1.1.5
and started solar and it came back! It repopulated the config.yaml, so I'm guessing it just wanted any values in there so it wouldn't error out.
While this is probably a bug w/ubuntu's packaging and may even be due to me running as a normal user, the configuration.yaml
file's _cleanup_load(c)
function should probably gracefully behave if there are no yaml entries in there rather than silently crashing.
That is all! This is probably going to have to also be addressed in the Ubuntu release, but I figured this was upstream so maybe it should be here as well. Thanks!