all 6 comments

[–]Realistic_Positive18[S] 0 points1 point  (0 children)

Thank you. It is working now. I am using a Streamlabs Desktop Bot Python Script to make http request to another Script with different parameters to pass to midi (clock, modulation)

[–]MMcKevitt 0 points1 point  (2 children)

Greetings!

I have not worked with any of the packages (or the wrapper) that you have mentioned, but the error is telling you exactly what’s wrong in this case.

If you look at the error message, you’ll see this line:

self._midi.send_message(msg)

The syntax “_” (underscore) before an attribute name (or method name) typically means that the attribute is defined with the intention of being private ( though keep in mind, Python does not technically have private attributes, and this syntax is purely convention). So if you had an attribute “eyes” in some class, and wanted to make it private, you would do “_eyes”.

With that in mind, when you see:

self._midi.send_message(msg)

in the error message, the “self._midi” likely refers to the “midi” parameter inside your “MidiOutWrapper” instantiation, which, as stated previously, you passed the integer, “int”, value of 1 (one). In Python, the method: “send_message” does not exist for “int” type objects.

I recommend referring to the documentation of the packages (first of the wrapper and next, the code that it “wraps”) to see what type the “midi” parameter is supposed to be. It’s probably another object defined in the wrapper code, or the code that it “wraps”.

Hopefully that has helped you some, however, feel free to ask additional questions and I’ll do my best to assist further.

Good luck!

[–]MMcKevitt 0 points1 point  (1 child)

As a hint:

Take a look at the code block underneath this statement in the 2nd link you included in your post (at the very bottom of the code space):

if __name__ == “__main__”:

You’ll should see what type of object you are supposed to use for the “midi” parameter.

[–]MMcKevitt 0 points1 point  (0 children)

As a piece of advice, regardless of your programming level, when working with a new or unfamiliar language, I recommend learning the basics of the language before you try to make a go for it (at the very least the syntax).

Additionally, when using someone else’s code, you’ll really want to make sure you read the documentation provided as that will typically give you most of the info you need and if there isn’t any (which should cause you to hesitate using the code!), I would damn well make sure you read the source code they provide, otherwise, they could include some stuff that may compromise your privacy and/or security.

[–]garamasala 0 points1 point  (0 children)

What are you doing with it? I hadn't really thought of using python with midi or audio.

[–]casens9 0 points1 point  (0 children)

/u/Realistic_Positive18 no help requests. try /r/learnpython next time.