Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
PyQt5 Class Properties Go Missing When Using QThreadPool
elveatles last edited by
I'm getting the strangest errors with PyQt5. I'm wondering if anyone else has had this problem. If I'm running running threads using the QThreadPool and QRunnable objects, sometimes my Python classes lose their properties. Here's some example code:
from PyQt5.QtCore import *
finished = pyqtSignal(dict)
def init(self, inputData):
self._inputData = inputData
self.abort = False
self.signals = RunnableSignals()
Do stuff. Check if aborted along the way
In a different class in the main thread:
self.runnable = Runnable(someVariable)
If I run two at a time, the first one is just fine, but the second one will raise an error. AttributeError: 'Runnable' object has no attribute 'abort'. It just makes no sense, I set self.abort = False in the init method.
Also, I don't know if this is worth mentioning, but I'm using Python.NET instead of C Python. Don't know if that has something to do with it.