SubConverterFileIOException-音乐21 show()

时间:2019-06-09 11:05:33

标签: python spyder music21

我刚刚安装了music21,并且正在尝试入门。我已经安装了Musescore3,但是无法使show()函数起作用。

我尝试按照我在网上找到的一些说明更改路径,但无济于事


from music21 import *

us = environment.UserSettings()
us['musicxmlPath'] = 'D:\\Program Files\\MuseScore 3\\bin\\Musescore3.exe'
us['musicxmlPath'] = 'D:\\Program Files\\MuseScore 3\\bin\\Musescore3.exe'

我正在尝试做一个简单的show()

from music21 import *

f = note.Note('F5')
f.show()

这是我得到的错误:

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.4.0 -- An enhanced Interactive Python.

runfile('D:/Users/Pedro/Pedro/Projeto Python-Música/music21test.py', wdir='D:/Users/Pedro/Pedro/Projeto Python-Música')
D:\Program Files\MuseScore 3\bin\Musescore3.exe
Traceback (most recent call last):

  File "<ipython-input-1-19e1672511d4>", line 1, in <module>
    runfile('D:/Users/Pedro/Pedro/Projeto Python-Música/music21test.py', wdir='D:/Users/Pedro/Pedro/Projeto Python-Música')

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
    execfile(filename, namespace)

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/Users/Pedro/Pedro/Projeto Python-Música/music21test.py", line 14, in <module>
    f.show()

  File "C:\ProgramData\Anaconda3\lib\site-packages\music21\base.py", line 2580, in show
    **keywords)

  File "C:\ProgramData\Anaconda3\lib\site-packages\music21\converter\subConverters.py", line 360, in show
    subformats=helperSubformats, **keywords)

  File "C:\ProgramData\Anaconda3\lib\site-packages\music21\converter\subConverters.py", line 938, in write
    fp = self.runThroughMusescore(fp, subformats, **keywords)

  File "C:\ProgramData\Anaconda3\lib\site-packages\music21\converter\subConverters.py", line 895, in runThroughMusescore
    return self.findPNGfpFromXMLfp(fpOut)

  File "C:\ProgramData\Anaconda3\lib\site-packages\music21\converter\subConverters.py", line 807, in findPNGfpFromXMLfp
    "png file of xml not found. Or file >999 pages?")

SubConverterFileIOException: png file of xml not found. Or file >999 pages?

2 个答案:

答案 0 :(得分:0)

有时路径中有空格时会出错-尝试将文件夹“ ProjetoPython-Música”重命名为“ Python-Musica”(还删除重音以确保unicode并不是问题),然后查看如果能解决问题。

答案 1 :(得分:0)

我遇到过这种情况,因为在jupyter上运行时无法使用Musscore3。 尝试在可以运行的终端上运行