Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 compatibility fix #83

Merged
merged 1 commit into from
Sep 1, 2016
Merged

Python 3 compatibility fix #83

merged 1 commit into from
Sep 1, 2016

Conversation

carlthome
Copy link
Contributor

@carlthome carlthome commented Aug 31, 2016

'#' * x causes a TypeError in Python 3 when x is interpreted as a float. Enforcing it to be an int.

Traceback (most recent call last):
  File "test.py", line 56, in <module>
    pm = pretty_midi.PrettyMIDI(midi_path)
  File "/home/carl/anaconda3/lib/python3.5/site-packages/pretty_midi/pretty_midi.py", line 75, in __init__
    self._load_metadata(midi_data)
  File "/home/carl/anaconda3/lib/python3.5/site-packages/pretty_midi/pretty_midi.py", line 164, in _load_metadata
    event.data[1], event.get_alternatives()),
  File "/home/carl/anaconda3/lib/python3.5/site-packages/pretty_midi/utilities.py", line 145, in mode_accidentals_to_key_number
    key = sharp_keys[num_accidentals % 7] + '#' * num_sharps
TypeError: can't multiply sequence by non-int of type 'float'

@craffel
Copy link
Owner

craffel commented Sep 1, 2016

Oops, right on, thanks. We need to add compatibility testing for Python 3.

@craffel craffel merged commit c9700f2 into craffel:master Sep 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants