diff options
| author | aeroaks <akshay.tvastr@yahoo.com> | 2014-11-20 10:15:44 +0530 |
|---|---|---|
| committer | aeroaks <akshay.tvastr@yahoo.com> | 2014-11-20 10:15:44 +0530 |
| commit | 8676286100f3914dce620aa5d99831f6c99bde38 (patch) | |
| tree | 2d285344431b86d7a7a5880a6e0d753b2313ce2a /examples | |
| parent | 65aacf15e34b022e5be090bbcb781d0f80cc9e7f (diff) | |
| download | websocket-client-8676286100f3914dce620aa5d99831f6c99bde38.tar.gz | |
executable in python3
dirty modification to allow execution in python3 as well.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/echoapp_client.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/echoapp_client.py b/examples/echoapp_client.py index e5232f7..c77bbbd 100644 --- a/examples/echoapp_client.py +++ b/examples/echoapp_client.py @@ -1,5 +1,8 @@ import websocket -import thread +try: + import thread +except ImportError: #TODO use Threading instead of _thread in python3 + import _thread import time import sys @@ -29,7 +32,11 @@ def on_open(ws): ws.close() print("Thread terminating...") - thread.start_new_thread(run, ()) + try: + thread.start_new_thread(run, ()) + except: + _thread.start_new_thread(run, ()) + if __name__ == "__main__": websocket.enableTrace(True) |
