From bb3fa955b245bcb14ec73138305111c335630ea6 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 29 May 2021 16:41:19 +0200 Subject: [PATCH] Fix websockets and AttributeError: 'NoneType' object has no attribute --- resources/lib/websocket_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index 816e8630..56901c15 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -162,6 +162,14 @@ class PlexWebSocketApp(websocket.WebSocketApp, if self.sleeptime < 6: self.sleeptime += 1 + def close(self, **kwargs): + """websocket.WebSocketApp is not yet thread-safe. close() might + encounter websockets that have already been closed""" + try: + websocket.WebSocketApp.close(self, **kwargs) + except AttributeError: + pass + def suspend(self, block=False, timeout=None): """ Call this method from another thread to suspend this websocket thread