【发布时间】:2013-11-24 00:26:44
【问题描述】:
我尝试在this blog之后使用 Python+PyObjC 制作一个简单的音乐流媒体应用程序
import Foundation
from AppKit import NSSound
sound = NSSound.alloc()
url = Foundation.NSURL.URLWithString_("http://206.217.213.235:8050/")
sound.initWithContentsOfURL_byReference_(url, True)
sound.play()
失败了
>>> sound.play()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: cannot access attribute 'play' of NIL 'NSSound' object
为什么?
【问题讨论】: