You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried this on the master branch on github as well, same issue.
Trying to force close a websocket from the client side, and .terminate() seemed to be just what I'm looking for.
python 2.7.3; Ubuntu 12.04 AMD64
Exception in thread WebSocketClient:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/someuser/.virtualenvs/myenv/local/lib/python2.7/site-packages/ws4py/websocket.py", line 430, in run
self.terminate()
File "/home/someuser/.virtualenvs/myenv/local/lib/python2.7/site-packages/ws4py/websocket.py", line 334, in terminate
s._cleanup()
AttributeError: 'NoneType' object has no attribute '_cleanup'
$ pip freeze
argparse==1.2.1
ws4py==0.3.4
wsgiref==0.1.2
This may well be due to the structure of my program, I'm still investigating. But it appears that ws4py is calling terminate() internally during cleanup even though I've already terminated the connection.
The text was updated successfully, but these errors were encountered:
inactivist
changed the title
Calling .terminate() results in AttributeError
Calling WebSocketClient.terminate() results in AttributeError
Apr 23, 2014
I'm getting the same exception. Here's a snippet that causes it:
from time import sleep
from ws4py.client.threadedclient import WebSocketClient
if __name__ == '__main__':
sock = WebSocketClient('wss://echo.websocket.org')
sock.connect()
sock.close()
sleep(0.2)
sock.terminate()
In my real code I'm calling sock.close() and sock.terminate() in a class's __exit__ function. The exception only happens occasionally but putting the sleep in the above snippets makes it happen every time. This makes me think it's probably a race condition between the main thread and the threadedclient thread.
Is this the right way to close a socket? Or should I be calling only one of close and terminate?
I tried this on the master branch on github as well, same issue.
Trying to force close a websocket from the client side, and .terminate() seemed to be just what I'm looking for.
python 2.7.3; Ubuntu 12.04 AMD64
This may well be due to the structure of my program, I'm still investigating. But it appears that ws4py is calling terminate() internally during cleanup even though I've already terminated the connection.
The text was updated successfully, but these errors were encountered: