运行时出现错误:
from music21 import *
n1 = note.Note('C4', quarterLength=1)
n2 = note.Note('A4', quarterLength=1)
s = stream.Stream()
s.append(n1)
s.append(n2)
s.show('lily.svg')
Traceback (most recent call last):
File "C:\Python34\test.py", line 7, in <module>
s.show('lily.svg')
File "C:\Python34\lib\site-packages\music21\base.py", line 2206, in show
return formatWriter.show(self, regularizedConverterFormat, app=app, subformats=subformats, **keywords)
File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 277, in show
returnedFilePath = self.write(obj, fmt, subformats=subformats, **keywords)
File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 245, in write
conv = lily.translate.LilypondConverter()
File "C:\Python34\lib\site-packages\music21\lily\translate.py", line 147, in __init__
self.setupTools()
File "C:\Python34\lib\site-packages\music21\lily\translate.py", line 177, in setupTools
versionString = versionString.split()[-1]
IndexError: list index out of range
我已经安装了 scipy 和 mathplotlib,所以 music21 不再抱怨它们不可用。我在 Windows 7 上运行 Python 3.4。
如果我改为使用s.show('musicxml.png')
获取图像,则会收到错误消息:
Traceback (most recent call last):
File "C:\Python34\test.py", line 7, in <module>
s.show('musicxml.png')
File "C:\Python34\lib\site-packages\music21\base.py", line 2206, in show
return formatWriter.show(self, regularizedConverterFormat, app=app, subformats=subformats, **keywords)
File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 147, in show
returnedFilePath = self.write(obj, fmt, subformats=subformats, **keywords)
File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 637, in write
fp = self.runThroughMusescore(fp, **keywords)
File "C:\Python34\lib\site-packages\music21\converter\subConverters.py", line 606, in runThroughMusescore
elif not os.path.exists(musescoreFile):
File "C:\Python34\lib\genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: can't specify None for path argument
我该怎么做才能获取图像(最好是 svg)?