0

I have installed Python and Kivy to Windows 7. Now there's a program:

from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
      def build(self):
          return Button(text='Hello World')

TestApp().run()

When I try to run it I get the following error:

   Traceback (most recent call last):
   File "E:\python\app1.py", line 1, in <module>
   from kivy.app import App
   File "E:\python\kivy.py", line 1, in <module>
   from kivy.app import App
    ModuleNotFoundError: No module named 'kivy.app'; 'kivy' is not a package
hidefromkgb
  • 5,834
  • 1
  • 13
  • 44

1 Answers1

1

The error occurred because you named your file kivy.py.So what is happening is that python looks for the file kivy in the current dir first and uses that.Since your file is not a package,you get this error.

To fix this error,rename your file to something else e.g hello.py and the program will run just fine

silverhash
  • 880
  • 8
  • 21