SpotlightKid / python-rtmidi

Python bindings for the cross-platform MIDI I/O library RtMidi
https://spotlightkid.github.io/python-rtmidi/
Other
349 stars 65 forks source link

Incorrect documentation for open_midi* functions #112

Closed mfncooper closed 1 year ago

mfncooper commented 2 years ago

The first line of the documentation for each of the open_midiinput, open_midioutput, and open_midiport functions states:

Open MIDI port for input or output and return MidiIn/MidiOut instance.

(or an appropriate variation of the above). This is incorrect, or at least incorrect and misleading.

The Returns clause for open_midiport correctly states that it returns:

A two-element tuple of a new MidiIn or MidiOut instance and the name of the MIDI port which was opened.

This Returns clause is not present for open_midiinput or open_midioutput.

Someone trying to use the simpler open_midiinput or open_midioutput functions is going to be confused as to why this code:

midiout = open_midioutput(0)
midiout.send_message(msg)

gives them the following error:

AttributeError: 'tuple' object has no attribute 'send_message'

The documentation for all three of the open_midi* functions should be updated to state that they return a tuple, not just the MidiIn/MidiOut instance.