From 8676286100f3914dce620aa5d99831f6c99bde38 Mon Sep 17 00:00:00 2001 From: aeroaks <akshay.tvastr@yahoo.com> Date: Thu, 20 Nov 2014 10:15:44 +0530 Subject: [PATCH] executable in python3 dirty modification to allow execution in python3 as well. --- examples/echoapp_client.py | 11 +++++++++-- 1 file 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)