Elektordi / obs-websocket-py

Python library to communicate with an obs-websocket server (for OBS Studio)
MIT License
235 stars 59 forks source link

MessageTimeout #70

Open niklasberlin opened 2 years ago

niklasberlin commented 2 years ago

Hi, i'm having a Problem with getting a MessageTimeout after i send a request to GetSceneItemList with the current PreviewScene after an on_preview Event, when i try this on other parts of my code it works fine and does not result in a timeout. According to the log of OBS and Wireshark a response (including "status":"ok") is send by the websocket plugin

in other words: when i make the request (GetSceneItemList) at the begining of my script (with the Scene Name i get via the getPreviewScene Request) evrything works fine, but when i make the request as a response for an PreviewSceneChange with the Scene name i get from the Event, the request runs into a timeout even though OBS and Wireshark confirm that a response has been send

here is a output from my terminal:

Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\Niklas\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner self.run() File "C:\Users\Niklas\AppData\Local\Programs\Python\Python310\lib\site-packages\obswebsocket\core.py", line 236, in run self.core.eventmanager.trigger(obj) File "C:\Users\Niklas\AppData\Local\Programs\Python\Python310\lib\site-packages\obswebsocket\core.py", line 281, in trigger callback(data) File "C:\Users\Niklas\Documents\scripte\python\obs-ws\app.py", line 120, in on_preview scene_Prev = getSrcForScene(current_Prev) File "C:\Users\Niklas\Documents\scripte\python\obs-ws\app.py", line 46, in getSrcForScene result = ws.call(requests.GetSceneItemList(sceneName)) File "C:\Users\Niklas\AppData\Local\Programs\Python\Python310\lib\site-packages\obswebsocket\core.py", line 162, in call r = self.send(payload) File "C:\Users\Niklas\AppData\Local\Programs\Python\Python310\lib\site-packages\obswebsocket\core.py", line 179, in send return self._wait_message(message_id) File "C:\Users\Niklas\AppData\Local\Programs\Python\Python310\lib\site-packages\obswebsocket\core.py", line 187, in _wait_message raise exceptions.MessageTimeout(u"No answer for message {}".format( obswebsocket.exceptions.MessageTimeout: No answer for message 18


I tested this on a windows 10 and an ubuntu Maschine, both running OBS Version 27.1.3 and obs-websocket-py Version 0.5.3

niklasberlin commented 2 years ago

i have created a minimalistic example that reproduces the error on my side:

timeout-demo.zip

zyzniewski commented 2 years ago

Looks like sending requests blocks receiving thread while still processing event handler. Should be solved with https://github.com/Elektordi/obs-websocket-py/issues/37

ajhollenbach commented 1 year ago

Receiving this error again with Web Socket Server built into OBS Studio 29.0.0 running the switch_scenes.py sample.