Problem: Launching Issues with exported Kivy programs for Windows that use audio (per this guide). The PyInstaller process completes and an EXE is produced, but the program crashes upon using audio functions. No issues are encountered when running the .py file directly.
Console output from failure to start:
C:\igapp\dist\expprog>expprog [INFO ] [Logger ] Record log in C:\Users\tmd\.kivy\logs\kivy_16-06-03_96.txt [INFO ] [Kivy ] v1.9.1 [INFO ] [Python ] v3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] [INFO ] [Factory ] 179 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored) [INFO ] [Text ] Provider: sdl2 [INFO ] [AudioGstplayer] Using Gstreamer 1.4.5.0 [INFO ] [Audio ] Providers: audio_gstplayer, audio_sdl2 (audio_ffpyplayer ignored) Traceback (most recent call last): File "G:\p\MyProgram\MyProgram.py", line 25, in <module> sounds.append(SoundLoader.load("data\\snd\\%s" % file)) File "c:\python34\lib\site-packages\kivy\core\audio\__init__.py", line 83, in load return classobj(source=filename) File "c:\python34\lib\site-packages\kivy\core\audio\audio_gstplayer.py", line 45, in __init__ super(SoundGstplayer, self).__init__(**kwargs) File "kivy\_event.pyx", line 273, in kivy._event.EventDispatcher.__init__ (kivy\_event.c:5348) File "kivy\properties.pyx", line 408, in kivy.properties.Property.__set__ (kivy\properties.c:5114) File "kivy\properties.pyx", line 446, in kivy.properties.Property.set (kivy\properties.c:5876) File "kivy\properties.pyx", line 501, in kivy.properties.Property.dispatch (kivy\properties.c:6557) File "kivy\_event.pyx", line 1224, in kivy._event.EventObservers.dispatch (kivy\_event.c:13497) File "kivy\_event.pyx", line 1130, in kivy._event.EventObservers._dispatch (kivy\_event.c:12696) File "c:\python34\lib\site-packages\kivy\core\audio\__init__.py", line 161, in on_source self.load() File "c:\python34\lib\site-packages\kivy\core\audio\audio_gstplayer.py", line 62, in load self.player.load() File "kivy\lib\gstplayer\_gstplayer.pyx", line 233, in kivy.lib.gstplayer._gstplayer.GstPlayer.load (kivy\lib/gstplayer\_gstplayer.c:2791) kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin Failed to execute script MyProgram
Workaround: try changing the audio provider to SDL2.
Set the Kivy audio environment variable in the py source file prior to importing any Kivy modules:
import os os.environ['KIVY_AUDIO'] = 'sdl2'
Savior.