Closed msampaio closed 11 years ago
O erro que ocorre na verificação de semelhança entre períodos:
AttributeError Traceback (most recent call last)
<ipython-input-79-e74e304e95da> in <module>()
----> 1 umazero.webpage.make_special_cases_webpage(allseg, songs)
/Users/marcos/Dropbox/ongoing/umazero/umazero/webpage.py in make_special_cases_webpage(AllSegmentsObj, songsObj)
417 print_lily(out, higher_similarity[0][1], '{0} (from 0 to 1)'.format(round(higher_similarity[1], 2)))
418 out.write(rst_header('Least similar', 3))
--> 419 print_lily(out, lower_similarity[0][0], '{0} (from 0 to 1)'.format(round(lower_similarity[1], 2)))
420 print_lily(out, lower_similarity[0][1], '{0} (from 0 to 1)'.format(round(lower_similarity[1], 2)))
421
/Users/marcos/Dropbox/ongoing/umazero/umazero/webpage.py in print_lily(out, SegmentObj, subtitle)
333 pngfile = os.path.splitext(os.path.basename(dest))[0]
334 SegmentObj.make_score()
--> 335 SegmentObj.score.write('png', dest)
336 _utils.image_trim(dest)
337
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/base.pyc in write(self, fmt, fp, **keywords)
3254 if 'coloredVariants' in keywords and keywords['coloredVariants'] is True:
3255 conv.coloredVariants = True
-> 3256 conv.loadFromMusic21Object(self)
3257 return conv.createPNG(fp)
3258 elif fileFormat in ['svg', 'lily.svg']:
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/lily/translate.pyc in loadFromMusic21Object(self, m21ObjectIn)
252 scoreObj = stream.Score()
253 scoreObj.insert(0, m21ObjectIn)
--> 254 self.loadObjectFromScore(scoreObj, makeNotation = False)
255 #raise LilyTranslateException("Unknown stream type %s." % (m21ObjectIn.__class__))
256
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/lily/translate.pyc in loadObjectFromScore(self, scoreIn, makeNotation)
330 self.setHeaderFromMetadata(scoreIn.metadata, lpHeader = lpHeader)
331
--> 332 self.context.contents = contents
333
334
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/lily/lilyObjects.pyc in __setattr__(self, name, value)
50 v.setParent(self)
51
---> 52 object.__setattr__(self, name, value)
53
54 def getParent(self):
AttributeError: can't set attribute
O problema na verdade é no método Segment.score.write
. É possível salvar em xml, mas não em png, pois ocorre este erro:
AttributeError Traceback (most recent call last)
<ipython-input-38-2eb4aa0de95d> in <module>()
----> 1 seg.score.write('png')
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/base.pyc in write(self, fmt, fp, **keywords)
3254 if 'coloredVariants' in keywords and keywords['coloredVariants'] is True:
3255 conv.coloredVariants = True
-> 3256 conv.loadFromMusic21Object(self)
3257 return conv.createPNG(fp)
3258 elif fileFormat in ['svg', 'lily.svg']:
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/lily/translate.pyc in loadFromMusic21Object(self, m21ObjectIn)
252 scoreObj = stream.Score()
253 scoreObj.insert(0, m21ObjectIn)
--> 254 self.loadObjectFromScore(scoreObj, makeNotation = False)
255 #raise LilyTranslateException("Unknown stream type %s." % (m21ObjectIn.__class__))
256
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/lily/translate.pyc in loadObjectFromScore(self, scoreIn, makeNotation)
330 self.setHeaderFromMetadata(scoreIn.metadata, lpHeader = lpHeader)
331
--> 332 self.context.contents = contents
333
334
/Users/marcos/.virtualenvs/choros/lib/python2.7/site-packages/music21-1.4.0-py2.7.egg/music21/lily/lilyObjects.pyc in __setattr__(self, name, value)
50 v.setParent(self)
51
---> 52 object.__setattr__(self, name, value)
53
54 def getParent(self):
AttributeError: can't set attribute
O problema não existe mais, provavelmente em função da solução da tarefa #68. O método Segment.score.write('png')
funciona sem problemas
A frase 1 deste choro está quebrando ao ser processada por
webpage.make_special_cases_webpage
. Não há problemas no parseamento nem na geração do xml da frase.Atualização do problema
O erro ocorre no método
score.write
, e não emwebpage.make_special_cases_webpage
.