0

I'm using PyQt5 as a GUI for my python app. Sometimes the code crashes with these types of errors:

pyqt5 error Image

Is there a way to log these types of crashes with explanation (like error exception).

Edit:
found an easy way.
just run via cli
>> py filename.py
works like magic. (or if using pycharm, debug mode)

yaron
  • 3
  • 3

1 Answers1

0

The general method for error catching is this:

try:
    # try something that does not work
    a*5
except Exception as e:
    print(e)

the output would look like this (for the example error):

name 'a' is not defined

Here is a link: https://docs.python.org/3/tutorial/errors.html

However, you might need to do other debugging, logging and printing to terminal to find the error.

D.L
  • 1,738
  • 2
  • 12
  • 25