I am trying to set up a websocket client inside C4D that can listen on localhost to messages from a websocket server.
I've got the actual websocket client to work, but when I test it currently it freezes up the entire UI (currently using the Script Manager - have not gotten to making it an actual "plugin" yet - that's another rabithole to go down next + including the websocket python library in said plugin).
I'm assuming I need threading or another way of asynconiously listening to the server's messages or otherwise C4D will continue being stuck?
I've tried what was suggested in this thread by ferdinand: https://plugincafe.maxon.net/topic/14395/c4d-threading-in-python-doesn-t-work-as-expect - but I'm getting stuck on the Plugin ID part. I've made an ID and replaced it, but I keep getting these errors:
Traceback (most recent call last): File "scriptmanager", line 3, in <module> ModuleNotFoundError:No module named 'urllib2' Traceback (most recent call last): TypeError: thread object is dead File "C:\Users\Gilles\AppData\Roaming\Maxon\C4D_CE91A9A0\library\scripts\Threader.py", line 138, in <module> AttributeError: 'traceback' object has no attribute 'Main' RegisterPlugins() File "C:\Users\Gilles\AppData\Roaming\Maxon\C4D_CE91A9A0\library\scripts\Threader.py", line 132, in RegisterPlugins "OSError: cannot find pyp file - plugin registration failed"
Sorry for the fairly vague post, but i'm running into different problems at the same time. In short:
- Websocket client in C4D - best practice for this?
- Plugin_ID - why do I need to do this, how do I properly do this?
- If it won't work in the scriptmanager, (because scriptmanager will freeze up even with threading) how do I do it without the scriptmanager?