Python中的Pyo;未定义名称“服务器" [英] Pyo in Python; name 'Server' not defined
问题描述
我使用python 3.6,我试图用pyo播放音频文件,但是当我尝试运行它时,却收到此消息;
回溯(最近通话最近):在第1行的文件"C:\ Python27 \ pyotest.py"从pyo进口*文件"C:\ Python27 \ pyo.py",第2行,在NameError:未定义名称服务器"
我的代码:
从pyo导入 *s = Server().boot()s.start()sf = SfPlayer("C:\ Users \ ***** \ Music \ sound.mp3",速度= 1,循环= True).out()
好像您已经创建了文件 C:\ Python27 \ pyo.py
.因此,无需导入实际的pyo模块,而是可以导入文件.
重命名文件 C:\ Python27 \ pyo.py
和与其关联的任何pyc文件( C:\ Python27 \ pyo.pyc
),然后重试>
I use python 3.6, and I am trying to play an audio file with pyo, but when I try to run it, I get this message;
Traceback (most recent call last): File "C:\Python27\pyotest.py", line 1, in from pyo import * File "C:\Python27\pyo.py", line 2, in NameError: name 'Server' is not defined
My code:
from pyo import *
s = Server().boot()
s.start()
sf = SfPlayer("C:\Users\*****\Music\sound.mp3", speed=1, loop=True).out()
Looks like you have created the file C:\Python27\pyo.py
. So instead of the actual pyo module getting imported, your file gets imported.
Rename the file C:\Python27\pyo.py
and any pyc file (C:\Python27\pyo.pyc
) associated with it and try again
这篇关于Python中的Pyo;未定义名称“服务器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!