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

Using splitByQuarterLengths on stream causes an AttributeError #1735

Closed
ggsimao opened this issue Oct 27, 2024 · 0 comments · Fixed by #1736
Closed

Using splitByQuarterLengths on stream causes an AttributeError #1735

ggsimao opened this issue Oct 27, 2024 · 0 comments · Fixed by #1736

Comments

@ggsimao
Copy link

ggsimao commented Oct 27, 2024

music21 version

9.1.0

Problem summary
Using splitByQuarterLengths on a stream object causes the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/acerola/.local/lib/python3.10/site-packages/music21/base.py", line 3364, in splitByQuarterLengths
    spannerList.extend(st.spannerList)
AttributeError: 'tuple' object has no attribute 'spannerList'

Steps to reproduce

>>> from music21 import stream, note
>>> stream.Measure([note.Note(quarterLength=8)]).splitByQuarterLengths([4, 4])

Expected vs. actual behavior
Expected: the function finishes executing and the stream is properly split.
Actual: AttributeError

More information
The st variable inside the splitAtQuarterLength function is of type _SplitTuple, but when it is returned to the splitByQuarterLengths function it reverts back to a regular tuple.

mscuthbert added a commit that referenced this issue Oct 28, 2024
Fixes #1735

Adds tests.

Thanks to Giulio Guilherme de Souza Simão for the perfect bug report!
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 a pull request may close this issue.

1 participant