Elektordi / obs-websocket-py

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

SetSourceSettings expects one argument but 3 were given #84

Closed BeeFox-sys closed 1 year ago

BeeFox-sys commented 1 year ago
    client.call(requests.SetSourceSettings(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Baserequests.__init__() takes 1 positional argument but 3 were given
client.call(requests.SetSourceSettings(
                    "source-name",
                    {"file": file_name}))

I am not sure why this nolonger works, it worked up until the requests made to be generated

NengQian commented 1 year ago

Same issue here, I believe this time you should intead use positional argument but use keyword arguement. But the question is, where can I find the correct keyword args' name?

Elektordi commented 1 year ago

@BeeFox-sys All requests now requires keyword (named) arguments. SetSourceSettings does not exist in new (v5) protocol, so I suppose you are using the old v4 protocol, you can find arguments here: https://github.com/obsproject/obs-websocket/blob/4.x-compat/docs/generated/protocol.md#setsourcesettings

In your case, you can use:

client.call(requests.SetSourceSettings(
                    sourceName="source-name",
                    sourceSettings={"file": file_name}
                    ))
riivrtwo commented 1 year ago

Is there a v5 method for accessing/modifying the file path of an image source in a similar way?

riivrtwo commented 1 year ago

Is there a v5 method for accessing/modifying the file path of an image source in a similar way?

nm, SetSourceSettings has been moved to SetInputSettings etc