executable in python3
dirty modification to allow execution in python3 as well.
This commit is contained in:
parent
65aacf15e3
commit
8676286100
@ -1,5 +1,8 @@
|
|||||||
import websocket
|
import websocket
|
||||||
import thread
|
try:
|
||||||
|
import thread
|
||||||
|
except ImportError: #TODO use Threading instead of _thread in python3
|
||||||
|
import _thread
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -29,7 +32,11 @@ def on_open(ws):
|
|||||||
ws.close()
|
ws.close()
|
||||||
print("Thread terminating...")
|
print("Thread terminating...")
|
||||||
|
|
||||||
thread.start_new_thread(run, ())
|
try:
|
||||||
|
thread.start_new_thread(run, ())
|
||||||
|
except:
|
||||||
|
_thread.start_new_thread(run, ())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
websocket.enableTrace(True)
|
websocket.enableTrace(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user