Im trying to convert my.py file to.exe. Im using kivy in my.py file.I realized that getting Fatal error detected.Failed to execute script main error if i use SoundLoader.load('test.wav') . main.py:
from kivy.app import App
from kivy.core.audio import SoundLoader
from kivy.uix.screenmanager import ScreenManager
class Manager(ScreenManager):
sound = SoundLoader.load('test.wav')
sound.play()
class testapp(App):
def build(self):
return Manager()
if __name__ == '__main__':
testapp().run()
If i run my.py file,i get sound on windows and linux systems.I followed these steps to create my exe: KIVY package for Windows . My exe runs if i do not use SoundLoader lines. But if i add that, i can't even open console or app because this error appears.Thanks for advices.
If you have same problem , Fix this lines in your .spec file:
from kivy_deps import sdl2, glew, gstreamer
...
...
datas=[('Files\test.wav','.')
...
...
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins + gstreamer.dep_bins)],
...
...
Worked for me..
This worked for me.
from kivy_deps import sdl2, glew, gstreamer
datas=[(r'Assets', 'bullet.wav'),
(r'Assets', 'music.wav'),
(r'Assets', 'Explosion.wav')],
*[Tree(p) for p in
(sdl2.dep_bins +
glew.dep_bins + gstreamer.dep_bins)],
The next thing helped me:
python -m pip install kivy[full]
This overlaped prior conda installation:
conda install -c conda-forge kivy
After that mp3 file played fine.
Packages alteration after installation from pip (my dir):
• kivy-deps.glew~=0.3.1
in f:\pzz\lib\site-packages (from kivy[full]) (0.3.1)
• kivy-deps.gstreamer~=0.3.3
in f:\pzz\lib\site-packages (from kivy[full]) (0.3.3)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.