0

I am using websockets library in my Python project. However the websocket library is raising connection exception when I hit Ctrl+C as follows:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 1073, in run
    self.function(*self.args, **self.kwargs)
  File "client.py", line 95, in <lambda>
    self.keepAliveTimer = Timer(15, lambda: self.sendKeepAlive())
  File "client.py", line 91, in sendKeepAlive
    self.ws.send(message)
  File "/Users/username/Library/Python/2.7/lib/python/site-packages/websocket/_app.py", line 156, in send
    "Connection is already closed.")
WebSocketConnectionClosedException: Connection is already closed.

However, the timestamp is not getting printed. What should I do that all the uncaught exceptions are printed with timestamp on stdout?

I don't need fix for this exception as I know the reason. My query is to get this as well as other exceptions printed on stdout with the timestamp.

Shashwat Kumar
  • 5,159
  • 2
  • 30
  • 66

0 Answers0