2013-08-05 84 views
0

我在Mac上搞亂了pyspotify,我一直在閱讀例子和文檔。我下載了一個示例應用程序(從pyspotify混帳回購協議的jukebox.py例子),當我在命令行中運行它,我得到如下:OSX上的pyspotify問題

Traceback (most recent call last): 
    File "jukebox.py", line 15, in <module> 
    AudioSink = import_audio_sink() 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 45, in import_audio_sink 
    raise ImportError, "\n".join(error_messages) 
ImportError: Tried to use spotify.audiosink.alsa.AlsaSink as audio sink, but failed: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink 
    module = __import__(module, fromlist=[cls]) 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/alsa.py", line 1, in <module> 
    import alsaaudio 
ImportError: No module named alsaaudio 

Tried to use spotify.audiosink.oss.OssSink as audio sink, but failed: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink 
    module = __import__(module, fromlist=[cls]) 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/oss.py", line 1, in <module> 
    import ossaudiodev 
ImportError: No module named ossaudiodev 

Tried to use spotify.audiosink.portaudio.PortAudioSink as audio sink, but failed: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink 
    module = __import__(module, fromlist=[cls]) 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/portaudio.py", line 1, in <module> 
    import pyaudio 
ImportError: No module named pyaudio 

Tried to use spotify.audiosink.gstreamer.GstreamerSink as audio sink, but failed: 
Traceback (most recent call last): 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink 
    module = __import__(module, fromlist=[cls]) 
    File "/Library/Python/2.7/site-packages/spotify/audiosink/gstreamer.py", line 3, in <module> 
    import gobject 
ImportError: No module named gobject 

Was not able to import any of the audio sinks 

我得到的Python包裝各種音頻API /源不存在,但我怎麼知道我是否需要/如何安裝gobject或pyaudio及其支持API?我嘗試過pyaudio,但它失敗了,因爲我沒有包裝它的庫(我認爲)。有沒有人得到過這個?謝謝!

+0

您是否設法爲此找到解決方案?我也一樣在苦苦掙扎? – skywlkr

回答

0

此作品爲master分支jukebox.py(截至2013年4月13日7eb1c53

brew install portaudio 

pip install pyaudio 

python -c "import pyaudio" 

然後:

python example-jukebox-master.py -u myuser -p mypassword 
Logging in, please wait... 
Logged in! 
jukebox> help 

Documented commands (type help <topic>): 
======================================== 
list ls 

Undocumented commands: 
====================== 
EOF    browse next queue   search toplist 
add_new_playlist help pause quit    shell unwatch 
add_to_playlist logout play remove_playlist stop watch 

> help ls 
List the playlists, or the contents of a playlist 

而這從目前的發展:

python example-jukebox.py -u myuser -p mypassword -a portaudio