Hi,
I've slung together a basic Slack notifier using ws4py and I'm pretty happy with it, however, when the network goes down, the thread crashes and I get various errors that I'd like to handle elegantly (below).
I can't see how/where I can add a try except to deal with them as the threadedclient runs it's own thread?
Am I missing something?
Thanks
Ed
Two example errors:
<LogRecord: ws4py, 40, C:\Python27\lib\site-packages\ws4py\websocket.py, 302, "Failed to receive data">
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 300, in once
b = self.sock.recv(self.reading_buffer_size)
File "C:\Python27\lib\ssl.py", line 246, in recv
File "C:\Python27\lib\ssl.py", line 165, in read
return self._sslobj.read(len)
error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond
and
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 55, in run
self.websocket.send(PongControlMessage(data='beep'))
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 265, in send
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 241, in _write
raise RuntimeError("Cannot send on a terminated websocket")
RuntimeError: Cannot send on a terminated websocket