'Rest' object has no attribute 'pitches'

midi.show('midi) is throwing me the error of
'Rest' object has no attribute 'pitches'. . how to fix this?

hey @Par1hsharma ,
can you share me a snapshot of the error or the code itself, not able to understand it like this here.