When I was using pyside, I used a thread to load modules.CodeDuring execution, an exception occurred during running. Even a simple print may be abnormal, so I found this discussion on stackoverflow, use the thread module of QT or the thread module of Python.
Most people recommend using the QT thread module because it needs to interact with application applications such as qtgui and has the advantages of signal/slot and event loop.
However, it is also discussed that Gil exists in Python and is used in the thread module of Python. However, when python uses a third-party module, Gil is released, when Python calls the QT thread, Gil exists in the Python code, while Gil does not exist in the QT thread code, therefore, you need to carefully set the logic and lock the code (this is my problem)
In addition, the currentthreadid function of qthread has a bug, which may cause exceptions.
Patch pyside. qtcore. qthread. currentthreadid.
ImportThread#Patch for qthread. currentthreadid bugQtcore. qthread. currentthreadid = thread. get_ident