T
T
TheMixRay2021-06-02 21:17:46
Python
TheMixRay, 2021-06-02 21:17:46

Why is Kivy throwing an error when I run the program?

The code:

from kivy.app import App
from kivy.uix.widget import Widget
import kivy
kivy.require('2.0.0')

class PongGame(Widget):
    pass


class PongApp(App):
    def build(self):
        return PongGame()


if __name__ == '__main__':
    PongApp().run()

Conclusion:
[INFO   ] [Logger      ] Record log in C:\Users\User\.kivy\logs\kivy_21-06-02_9.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.3.2
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Program Files\Python37\python.exe"
[INFO   ] [Factory     ] 186 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pil (img_sdl2, img_ffpyplayer ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - ImportError: DLL load failed: Не найден указанный модуль.
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\kivy\core\__init__.py", line 62, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\kivy\core\window\window_sdl2.py", line 27, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[CRITICAL] [App         ] Unable to get a Window, abort.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-06-02
@TheMixRay

Google found an issue on github kivy . The last post from February of this year points to the need to add a couple of directories to the PATH environment variable, something like this.

# you must add to the path the location of your SDL2 binaries
os.environ['PATH'] += ';' + os.path.expandvars('%AppData%\\Python\\share\\glew\\bin')
os.environ['PATH'] += ';' + os.path.expandvars('%AppData%\\Python\\share\\sdl2\\bin')

However, it is mentioned above that this is only necessary if python is installed to a non-standard path. It is also worth checking if python is installed as an admin (for all users) or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question