Open sertansenturk opened 9 years ago
I tried this Mozart score http://kern.ccarh.org/cgi-bin/ksdata?l=users/craig/classical/mozart/piano/sonata&file=sonata01-1.krn&f=kern, and it was loaded successfully.
This is the error shown when trying to load @sertansenturk 's score in music21:
In [12]: s = converter.parse('U0285.krn')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-2121f242c19d> in <module>()
----> 1 s = converter.parse('U0285.krn')
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/converter.pyc in parse(value, *args, **keywords)
1093 return parseData(value, number=number, format=m21Format)
1094 elif os.path.exists(value):
-> 1095 return parseFile(value, number=number, format=m21Format, forceSource=forceSource)
1096 elif (value.startswith('http://') or value.startswith('https://')):
1097 # its a url; may need to broaden these criteria
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/converter.pyc in parseFile(fp, number, format, forceSource)
998 '''
999 v = Converter()
-> 1000 v.parseFile(fp, number=number, format=format, forceSource=forceSource)
1001 return v.stream
1002
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/converter.pyc in parseFile(self, fp, number, format, forceSource)
818 raise ConverterFileException('cannot find a format extensions for: %s' % fp)
819 self._setConverter(useFormat, forceSource=forceSource)
--> 820 self._converter.parseFile(fp, number=number)
821 self.stream.filePath = fp
822 self.stream.fileNumber = number
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/converter.pyc in parseFile(self, filepath, number)
275 def parseFile(self, filepath, number=None):
276 '''Open Humdram data from a file path.'''
--> 277 self.data = humdrum.parseFile(filepath)
278 #self.data.stream.makeNotation()
279
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/humdrum/__init__.pyc in parseFile(filename)
163 shortcut to :class:`~music21.humdrum.spineParser.HumdrumFile`. Most users will call `converter.parse()` instead.
164 '''
--> 165 return spineParser.HumdrumFile(filename)
166
167 def parseData(data):
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/humdrum/spineParser.pyc in __init__(self, filename)
703 try:
704 humFH = open(filename)
--> 705 self.eventList = self.parseFH(humFH)
706 except IOError:
707 raise
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/humdrum/spineParser.pyc in parseFH(self, fileHandle)
714 for line in fileHandle:
715 spineDataCollection.append(line)
--> 716 return self.parseLines(spineDataCollection)
717
718 class HumdrumLine(object):
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/humdrum/spineParser.pyc in parseLines(self, dataStream)
160
161 self.parsePositionInStream = 0
--> 162 self.parseEventListFromDataStream(dataStream) # sets self.eventList and fileLength
163 try:
164 assert(self.parsePositionInStream == self.fileLength)
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/humdrum/spineParser.pyc in parseEventListFromDataStream(self, dataStream)
349 continue # technically forbidden by Humdrum but the source of so many errors!
350 elif re.match('\!\!\!', line):
--> 351 self.eventList.append(GlobalReferenceLine(self.parsePositionInStream, line))
352 elif re.match('\!\!', line): ## find global comments at the top of the line
353 self.eventList.append(GlobalCommentLine(self.parsePositionInStream, line))
/usr/local/lib/python2.7/dist-packages/music21-1.7.1-py2.7.egg/music21/humdrum/spineParser.pyc in __init__(self, position, contents)
816 noExclaim = re.sub('^\!\!\!+','',contents)
817 try:
--> 818 (code, value) = noExclaim.split(":", 1)
819 value = value.strip()
820 if (code is None):
ValueError: need more than 1 value to unpack
@Rafael-Caro has tried to open the krn files using the modules in music21 (http://web.mit.edu/music21/doc/moduleReference/moduleHumdrum.html) and the files faile to be read. It might be because:
I will try to find the reason and solve this issue accordingly.