WARNING: QApplication was not created in main() thread

浪子不回头ぞ 提交于 2019-12-11 07:59:21

问题


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)"

来源:https://stackoverflow.com/questions/52076262/warning-qapplication-was-not-created-in-main-thread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!