wrap test for IDLE in try/catch
if no network connection has been established when trying to determine
use_idle (if it was None) don't stop and try again from the thread
later.
@@ -81,12 +81,14 @@ class Py3status:
if self.security not in ["ssl", "starttls"]:
raise ValueError("Unknown security protocol")
if self.use_idle is None:
- # connect once to check if we can use IDLE
+ try:
self._connect()
self._disconnect()
- # disconnect
- if self.use_idle:
+ except:
+ self.py3.log("Cannot detect IDLE capability -- likely no connection", level=self.py3.LOG_WARNING)
+
self.idle_thread = Thread(target=self._get_mail_count, daemon=True)
+ if self.use_idle:
self.idle_thread.start()
def check_mail(self):
