From 2a886ffa1e6db356d3d1e9edceeab2cd88d00360 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 16 Mar 2016 21:45:26 -0500 Subject: [PATCH] Fix KeyError when using backend-specific updates formatter When a backend-specific formatter (i.e. ``{Pacman}``, ``{Cower}``, etc.) is used, and the initial "working" status is set, the loop in which the update totals is compiled has not yet run, leading to a KeyError. This commit fixes the traceback by setting initial values of "?" for these formatters before the initial "working" status is set. --- i3pystatus/updates/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/i3pystatus/updates/__init__.py b/i3pystatus/updates/__init__.py index e0d1a69..7fd15ac 100644 --- a/i3pystatus/updates/__init__.py +++ b/i3pystatus/updates/__init__.py @@ -92,6 +92,11 @@ class Updates(Module): @require(internet) def check_updates(self): + for backend in self.backends: + key = backend.__class__.__name__ + if key not in self.data: + self.data[key] = '?' + self.output = { "full_text": formatp(self.format_working, **self.data).strip(), "color": self.color_working,