For this problem (stackoverflow.com/questions/4086435/) I tried to create a Python 3 version of the python-websocket library (github.com/mtah/python-websocket/), here is my code: https://gist.github.com/ 663175 .
Blender ships with its Python 3.1 package, so I added the file directly to the "site-packages" folder. I am getting this error now:
Traceback (most recent call last):
File "websocket.py", line 6, in
AttributeError: 'module' object has no attribute 'WebSocket'
when running this code in Blender:
import sys, os, asyncore, websocket
def msg_handler(msg):
print(msg)
socket = websocket.WebSocket('ws://localhost:8080/', onmessage=msg_handler)
socket.onopen = lambda: socket.send('Hello world!')
try:
asyncore.loop()
except KeyboardInterrupt:
socket.close()
I found that a is __init__.pynecessary, so I added, but it didn’t help ... What am I doing wrong here? Thank you for your help.