我在尝试制作我的第一个 spotify 应用程序时遇到了问题。我在树莓派上,运行 Arch。
我在一个目录中有我的__main__.py
和我spotify_appkey.key
的,我运行它[root@RPI]# python2 __main__.py
中的代码__main__.py
如下所示:
import spotify
print "1"
session = spotify.Session()
print "2"
try:
session.login('myUsername', 'myPassword')
print "3"
except IOError as e:
print "error({0}): {1}".format(e.errno, e.strerror)
这给了我这个输出:
1
2
Segmentation fault (core dumped)
阅读此链接,我也尝试过:
import spotify
print "1"
session = spotify.Session()
print "2"
config = spotify.Config()
print "3"
try:
session.login('myUsername', 'myPassword')
print "4"
except IOError as e:
print "error({0}): {1}".format(e.errno, e.strerror)
这给了我这个:
1
2
Traceback ..... yada yada ...
File "__main__.py" ... yada yada...
config = spotify.Config()
AttributeError: 'module' object has no attribute 'Config'
我究竟做错了什么?