我对Kivy很新,当我运行此代码时,我收到错误:
[INFO ] [Logger ] Record log in /home/kid/.kiv /logs/kivy_15-08-30_30.txt
[INFO ] [Kivy ] v1.9.1-dev
[INFO ] [Python ] v2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]
[INFO ] [AudioGstplayer] Using Gstreamer 1.2.4.0
[INFO ] [Audio ] Providers: audio_gstplayer, audio_sdl2(audio_ffpyplayer ignored)
Sound found at a better day.mp3
[ERROR ] [AudioGstplayer] Resource not found.
[ERROR ] [AudioGstplayer] Resource not found.
Sound is -1.000 seconds
完整代码:
from kivy.core.audio import SoundLoader
sound = SoundLoader.load('a better day.mp3')
if sound:
print("Sound found at %s" % sound.source)
print("Sound is %.3f seconds" % sound.length)
sound.play()
答案 0 :(得分:0)
你没有更好的一天.mp3'您文件夹中的命名文件这是显示该错误的原因,因为它无法找到该音频文件(找不到资源)。