bspaans/python-mingus

midi_file_in.py opens midi file in text mode

Closed this issue · 1 comments

I'm trying to use midi_file_in.MIDI_to_Composition() to read in a midi file that I previously created using midi_file_out.write_Track().

A UnicodeDecodeError exception is being thrown when parse_midi_file_header() tries to read the first 4 bytes from the file.

I believe this is due to parse_midi_file() calling open(file, "r").

Should it be using "rb" to open the file in binary mode instead?

I am using mingus 0.6.0 on Python 3.6.9 on Linux Mint 19.3.

Hi @reticulatus, thanks for the report! Indeed the binary flag was missing. This is fixed on master and I will make a release shortly. Please let me know if your issue's fixed.