Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. class QtConcurrent does not has methods such as 'run()', 'reduce()', 'map()' and so on in PySide6 (6.4.2)
QtWS25 Last Chance

class QtConcurrent does not has methods such as 'run()', 'reduce()', 'map()' and so on in PySide6 (6.4.2)

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 709 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Johnnyhq
    wrote on last edited by
    #1

    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.

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher moved this topic from General and Desktop on
    • J Johnnyhq

      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.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Johnnyhq
      I am not certain about this, but I don't believe you can use QtConcurrent from Python/PySide/PyQt. See the following post
      https://stackoverflow.com/questions/32378719/qtconcurrent-in-pyside-pyqt

      Also, 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.

      J 1 Reply Last reply
      1
      • JonBJ JonB

        @Johnnyhq
        I am not certain about this, but I don't believe you can use QtConcurrent from Python/PySide/PyQt. See the following post
        https://stackoverflow.com/questions/32378719/qtconcurrent-in-pyside-pyqt

        Also, 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.

        J Offline
        J Offline
        Johnnyhq
        wrote on last edited by
        #3

        @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.

        JonBJ 1 Reply Last reply
        0
        • J Johnnyhq

          @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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @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 with QThreadPool.

          J 1 Reply Last reply
          1
          • JonBJ JonB

            @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 with QThreadPool.

            J Offline
            J Offline
            Johnnyhq
            wrote on last edited by
            #5

            @JonB OK, thanks, JonB.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved