WARNING: QApplication was not created in main() th

2019-08-08 08:16发布

问题:

When I try to develop a parallel python application using the ~threading module~, I get the following error

Python Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)"

I'm using python 3.6 ,Linux 16.04 and Pycharm 2018

I cannot understand the reason and how to fix it.

Code Sample:

numOfThread = 8
class myThread (threading.Thread):
   def __init__(self, thread_id, name, frames):
      threading.Thread.__init__(self)
      self.thread_id = thread_id
      self.name = name
      self.frames = frames
      self.out_frame = None

   def run(self):
      print("Starting " + self.name)
      self.out_frame = trackingmario(self.frames)


list_of_threads = []

print("Start.....\n")

for i in range(numOfThread):
    list_of_threads.append(myThread(i, 'thread_'+str(i), lists[i]))


for i in range(numOfThread):
    list_of_threads[i].start()

for ti in list_of_threads:
    ti.join()

Image show the error : "Python Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)"