Skip to content
Advertisement

Prevent Kivy leaving debug messages

I have a simple a Kivy interface that also uses the terminal.

Example code:

import kivy

kivy.require('1.0.6')

from kivy.app import App
from kivy.uix.label import Label

class MyApp(App):
    def build(self):
        return Label(text = 'Hello')

MyApp().run()

The problem is that whenever I start the script I get this:

[INFO   ] [Logger      ] Record log in C:UsersSimon.kivylogskivy_18-05-12_37.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [OSC         ] using <thread> for socket
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.5.13467 Compatibility Profile Context 21.19.414.1280'>
[INFO   ] [GL          ] OpenGL vendor <b'ATI Technologies Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'AMD Radeon R7 Graphics'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 5
[INFO   ] [GL          ] Shading version <b'4.50'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [Base        ] Leaving application in progress...

I have found that this is Kivy’s automatic debugging messages. How do I prevent them (or at least hide so that I can use the terminal)?

Advertisement

Answer

As shown in the docs, you should only do the following:

import os
os.environ["KIVY_NO_CONSOLELOG"] = "1"

import kivy
...
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement