When you are developing a pyqt gui application, you may encounter this kind of problem: The gui application crashed suddenly, however, there is no any error message is displayed. You can not find out where is wrong in your python script. To fix this problem, we will tell you how to do in this tutorial.
For example, we have created a thread in our python script, however, we have not imported python threading package.
#import threading def startSearch(self, dir, text, type='.php'): if self.search_thread: try: stop_thread(self.search_thread) except: pass self.search_thread = None self.search_thread = threading.Thread(target=self.searchText, args=[dir, text, type]) self.search_thread.start()
You may can run your pyqt gui application, however, if you run startSearch() function, this gui application will crash and no any error message will be displayed.
How to fix this problem?
We can use code below at the beginning of your python script.
#import threading import cgitb cgitb.enable(format = 'text')
Then you run your pyqt gui application again, you may find error message like this:
Then you can find what is wrong in your python script and fix it.
Thank you this helped sooo much!