From aeec2e86f388985a8c95b33fba51500efa145f77 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 17 Oct 2016 20:05:05 -0300 Subject: [PATCH] online module: Don't fail when offline If the system is offline, socket.gaierror is raised, the module crashes, and shows `offline` indefinitely. Catch that exception, and return False. --- i3pystatus/core/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3pystatus/core/util.py b/i3pystatus/core/util.py index a3c40bd..8ff40f9 100644 --- a/i3pystatus/core/util.py +++ b/i3pystatus/core/util.py @@ -373,7 +373,7 @@ class internet: try: socket.create_connection(cls.address, 1).close() return True - except OSError: + except (OSError, socket.gaierror): return False