This is the content of the Kiwi file:

# File name: hello2.kv #: kivy 1.9.0 <Label>: text: "Hello world!" 

This is a python:

 import kivy kivy.require ('1.9.0') from kivy.app import App from kivy.uix.button import Label class Hello2App(App): def build(self): return Label() if __name__ == "__main__": Hello2App().run() 

And here is the result. Result error

What is the problem, please help? What does not work?

  • Why do you have different versions of the kivy in the code and at startup? - titov_andrei
  • I am writing from a textbook, I installed it later) - Ivan Pirognoe
  • try to start a project in PyCharm, dependencies and errors are easier to recognize, your code is quite working, apparently there is a problem with installing some dependencies - titov_andrei
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦

3 answers 3

In fact, this error arises from the fact that the kivy logger cannot output the log to a file, as a result of not being able to correctly interpret the paths containing Cyrillic characters (which is what you actually have written in the log). The log is output to the .kivy home folder, the default path for which in windows vista and above is defined as "c:\Users\USER_NAME\.kivy\" . Those. The reason lies in the fact that your windows username is written with the contents of the Cyrillic characters (ie, Russian letters). There are several ways that you can do this:

  • the most logical, of course, is to never call the user in the Russian layout, because, like in other programs, there are similar problems.

  • the most hacking and dirty is to patch the __init__.py file in the root directory of the kivy library by changing kivy_home_dir in the kivy_home_dir = join(user_home_dir, '.kivy') to the desired path. But when upgrading, everything will return “to normal”, and indeed it’s necessary to beat him for this, X)

  • the easiest is to create a new environment variable KIVY_HOME in which to prescribe another path for the .kivy folder, which will not contain Cyrillic characters.

  • the most correct and difficult is to fix this bug in kivy, so logger.py would correctly decode all the characters and send a pull request to the master Kivy branch on github :)

    You have Python 2.7 - try changing this:

      text: u"Hello world!" 

      Try to put the kv file in the folder with file and write.

       import kivy kivy.require ('1.9.0') from kivy.app import App from kivy.uix.button import Label from kivy.lang.builder import Builder Builder.load_file('hello2.kv') class Hello2App(App): def build(self): return Label() if __name__ == "__main__": Hello2App().run()