From 3e412609093374ef2ce9d26a9724b2ef6d1b0ca7 Mon Sep 17 00:00:00 2001 From: Jakob Hansen Date: Sun, 1 Oct 2023 23:32:05 -0500 Subject: [PATCH] wrap pitch access in try/catch --- music21/tree/verticality.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/music21/tree/verticality.py b/music21/tree/verticality.py index 7df4646b3..1efb3b644 100644 --- a/music21/tree/verticality.py +++ b/music21/tree/verticality.py @@ -814,8 +814,11 @@ def conditionalAdd(ts, n: note.Note) -> None: from music21 import stream nonlocal pitchBust # love Py3!!! - p = n.pitch - pitchKey = p.nameWithOctave + try: + p = n.pitch + pitchKey = p.nameWithOctave + except AttributeError: + return pitchGroup = None if addPartIdAsGroup: