Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error handling in Kivy

Tags:

python

kivy

I just started using Kivy and was wondering how I am supposed to handle exceptions. For example, in a simple Python script that runs in the command line, I would normally print the error first then use sys.exit(1) to exit the script. However, I noticed sys.exit(1) causes my Kivy application to completely close.

What is the proper way to handle this?

Thanks!

like image 948
fire_water Avatar asked Oct 23 '25 18:10

fire_water


1 Answers

In order to handle errors, you should look at the ExceptionHandler class.

After following the discussion on the Kivy GitHub page, it seems the most graceful way to handle errors is to just handle errors with Python as you normally would, but you could use the ExceptionHandler class.

like image 123
freddiev4 Avatar answered Oct 25 '25 06:10

freddiev4



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!