obs-websocket + APScheduler
See original GitHub issueHello , I am just working on a project using both libraries obs-websocket + APScheduler . I used obs-websocket in conjunction with APSscheduler in order to schedule some jobs. The jobs update some scenes and objects inside the scene.
I used atomical function like this:
def createOBSWS():
host = settings.WS_HOST
port = settings.WS_PORT
password = settings.WS_PASS
websocket = obsws(host, port, password)
return websocket
....
....
if (websocket is None):
websocket = createOBSWS()
websocket.connect()
websocket.call(requests.SetCurrentScene(sceneName))
websocket.disconnect()
In both linux and win box , I am getting this kind of errors .
WIN
.... venv\lib\site-packages\websocket\_socket.py", line 139, in _send return sock.send(data) OSError: [WinError 10038] Tentativo di operazione su un elemento diverso dal socket
DEB
lib/python3.5/site-packages/websocket/_socket.py", line 139, in _send return sock.send(data) OSError: [Errno 9] Bad file descriptor
They are both related. I supposed that I call the disconnect before sending the command to the obs-websocket-server , but I followed your examples. I tried your last release 0.5, python 3.5 (Debian), python 3.6 (Win)
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
Oh, thanks for the traceback, I can see the problem is on the receiving thread!
I think the problem is threads being handled differently because of APScheduler… The receiving is not interrupted correctly… Could you try the branch bugfix-32 I just pushed? It should ignore OS exceptions during socket disconnection.
But I also work with Django on others projets, and I had many problems with a scheduler on one. I finally discover it came from Django multi-thread architecture, my jobs were started multiple times at the same moment. I finally fixed using this “if”:
init()
was called by ready(self) in my AppConfig (file apps.py) Maybe it can help you…