Killing Python Process
Im going to admit I am a noob and I have googled extensively multiple times but I cant wrap my head around how to properly kill a bot in Python.
Im doing this: sys.exit(1)
Here is what happens:
Exception in thread Thread-10: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 756, in run self.function(_self.args, *_self.kwargs) File "/var/python/ttapi/ttapi.py", line 57, in updatePresTmr self.updatePresence() File "/var/python/ttapi/ttapi.py", line 197, in updatePresence self._send(rq, callback) File "/var/python/ttapi/ttapi.py", line 175, in _send self.ws.send('~m~%s~m~%s' % (len(msg), msg)) File "/var/python/ttapi/websocket.py", line 469, in send self.sock.send(data) AttributeError: 'NoneType' object has no attribute 'send'
Exception in thread Thread-11: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 756, in run self.function(_self.args, *_self.kwargs) File "/var/python/ttapi/ttapi.py", line 57, in updatePresTmr self.updatePresence() File "/var/python/ttapi/ttapi.py", line 197, in updatePresence self._send(rq, callback) File "/var/python/ttapi/ttapi.py", line 175, in _send self.ws.send('~m~%s~m~%s' % (len(msg), msg)) File "/var/python/ttapi/websocket.py", line 469, in send self.sock.send(data) AttributeError: 'NoneType' object has no attribute 'send'
Exception in thread Thread-12: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 756, in run self.function(_self.args, *_self.kwargs) File "/var/python/ttapi/ttapi.py", line 57, in updatePresTmr self.updatePresence() File "/var/python/ttapi/ttapi.py", line 197, in updatePresence self._send(rq, callback) File "/var/python/ttapi/ttapi.py", line 175, in _send self.ws.send('~m~%s~m~%s' % (len(msg), msg)) File "/var/python/ttapi/websocket.py", line 469, in send self.sock.send(data) AttributeError: 'NoneType' object has no attribute 'send'
I dont see anything before this that Im doing. Am I doing it wrong?
Fixed in #118. The issue is with the timer thread as it tries to use a websocket that is no longer available.
The pull request #118 has been merged. So you can kill your python bot gracefully with Ctrl + c.