python-rtmidi icon indicating copy to clipboard operation
python-rtmidi copied to clipboard

Incorrect documentation for open_midi* functions

Open mfncooper opened this issue 2 years ago • 0 comments

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.

mfncooper avatar Jul 19 '22 15:07 mfncooper