class QtConcurrent does not has methods such as 'run()', 'reduce()', 'map()' and so on in PySide6 (6.4.2)
-
The following snippet code is run in a python console In Pycharm,
from PySide6.QtConcurrent import QtConcurrent help(QtConcurrent.run())
AttributeError is shot:
Traceback (most recent call last): File "C:\Anaconda3\envs\python39\lib\code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <module> AttributeError: type object 'PySide6.QtConcurrent.QtConcurrent' has no attribute 'run'
My python environment is Python 3.9.16 installed in window 11 64bit system.
How do I solve this issue? Does anybody encounter it. -
C Christian Ehrlicher moved this topic from General and Desktop on
-
The following snippet code is run in a python console In Pycharm,
from PySide6.QtConcurrent import QtConcurrent help(QtConcurrent.run())
AttributeError is shot:
Traceback (most recent call last): File "C:\Anaconda3\envs\python39\lib\code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <module> AttributeError: type object 'PySide6.QtConcurrent.QtConcurrent' has no attribute 'run'
My python environment is Python 3.9.16 installed in window 11 64bit system.
How do I solve this issue? Does anybody encounter it.@Johnnyhq
I am not certain about this, but I don't believe you can useQtConcurrent
from Python/PySide/PyQt. See the following post
https://stackoverflow.com/questions/32378719/qtconcurrent-in-pyside-pyqtAlso, neither PyQt nor PySide provide any of the functionality provided by QtConcurrent, because it's all template-based and therefore impossible to wrap.
That was from 2015 and would have applied to PySide2/PyQt5, but I suspect it still holds.
The PySide6 docs are at https://doc.qt.io/qtforpython-6/PySide6/QtConcurrent/QtConcurrent.html and https://doc.qt.io/qtforpython-6/PySide6/QtConcurrent/index.html. That is all there is! I think it just defines some enums/types, and that is all you get in Python.
You can use
QThread
,QThreadPool
or Python threads.If you are a beginner beware that we find many newcomers try to use threads when there is no need in Qt.
-
@Johnnyhq
I am not certain about this, but I don't believe you can useQtConcurrent
from Python/PySide/PyQt. See the following post
https://stackoverflow.com/questions/32378719/qtconcurrent-in-pyside-pyqtAlso, neither PyQt nor PySide provide any of the functionality provided by QtConcurrent, because it's all template-based and therefore impossible to wrap.
That was from 2015 and would have applied to PySide2/PyQt5, but I suspect it still holds.
The PySide6 docs are at https://doc.qt.io/qtforpython-6/PySide6/QtConcurrent/QtConcurrent.html and https://doc.qt.io/qtforpython-6/PySide6/QtConcurrent/index.html. That is all there is! I think it just defines some enums/types, and that is all you get in Python.
You can use
QThread
,QThreadPool
or Python threads.If you are a beginner beware that we find many newcomers try to use threads when there is no need in Qt.
-
@JonB Thanks, JonB. I have already used QThreadPool to implement my multi-tasks in a way that seems not so efficient as QThreadPool is a low-level multi-thread class. I read the official document, it recommends using QtConcurrent.
-
@Johnnyhq
What would you like me to say to this? So far as I know you cannot from Python, since it's all template based, unless you change to C++, and I don't think it does any more than you can do withQThreadPool
.