music21 version
9.9.1
Operating System(s) checked
macOS, Linux (platform-agnostic issue)
Problem summary
When music21.converter.parse opens a compressed MusicXML (MXL) that contains only one XML file with the filename exactly as .xml, it throws an exception. Upon further investigation, the line at
|
if pathlib.Path(subFp).suffix not in ['.musicxml', '.xml', '.mxl']: |
fails to include
.xml because
.suffix returns an empty string for
.xml.
Steps to reproduce
First, use Noteflight to produce an MXL file (because they consistently produce MXL files with this issue), then simply
import music21
music21.converter.parse("mxl.mxl")
will throw an exception.
More information
A quick fix would be to also match file extensions as is as extra testing conditions.