Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Async qt: Python
Forum Updated to NodeBB v4.3 + New Features

Async qt: Python

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.0k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Caeden
    wrote on 4 Sept 2021, 09:40 last edited by
    #1

    I have my asynchronous function inside @asyncSlot():

    msg = QMessageBox()
    
            if not self.id_edit.text():
                msg.setText('Specificy an id')
                msg.exec_() 
                return
            
            final_object =  await self.filter_id()
            if final_object:
                return await final_object.send(self.message_edit.text() if self.message_edit.text() else 'Hello')
    
            msg.setText('Invalid id')
            msg.exec_()
    

    It works completely fine, but I am receieving an error from the final

    msg.setText('Invalid id')
            msg.exec_()
    

    It shows up, but gives this error twice:

    Traceback (most recent call last):
      File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
        self._context.run(self._callback, *self._args)
    RuntimeError: Cannot enter into task <Task pending name='Task-9' coro=<ConnectionState._delay_ready() running at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\state.py:415> wait_for=<Future 
    finished result=None>> while another task <Task pending name='Task-70' coro=<MainWindow.trigger_message() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:174> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> is being executed.
    

    does this have anything to do with the fact im using asyncQt?

    E 1 Reply Last reply 4 Sept 2021, 09:47
    0
    • C Caeden
      4 Sept 2021, 09:40

      I have my asynchronous function inside @asyncSlot():

      msg = QMessageBox()
      
              if not self.id_edit.text():
                  msg.setText('Specificy an id')
                  msg.exec_() 
                  return
              
              final_object =  await self.filter_id()
              if final_object:
                  return await final_object.send(self.message_edit.text() if self.message_edit.text() else 'Hello')
      
              msg.setText('Invalid id')
              msg.exec_()
      

      It works completely fine, but I am receieving an error from the final

      msg.setText('Invalid id')
              msg.exec_()
      

      It shows up, but gives this error twice:

      Traceback (most recent call last):
        File "C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
          self._context.run(self._callback, *self._args)
      RuntimeError: Cannot enter into task <Task pending name='Task-9' coro=<ConnectionState._delay_ready() running at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\state.py:415> wait_for=<Future 
      finished result=None>> while another task <Task pending name='Task-70' coro=<MainWindow.trigger_message() running at c:\Users\caede\Desktop\Github\integrated-bot-gui\bot-gui\src\Mainwindow.py:174> cb=[asyncSlot.<locals>._error_handler() at C:\Users\caede\AppData\Local\Programs\Python\Python39\lib\site-packages\qasync\__init__.py:775]> is being executed.
      

      does this have anything to do with the fact im using asyncQt?

      E Offline
      E Offline
      eyllanesc
      wrote on 4 Sept 2021, 09:47 last edited by
      #2

      @Caeden please provide a minimal and reproducible example.

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Caeden
        wrote on 4 Sept 2021, 10:09 last edited by Caeden 9 Apr 2021, 10:09
        #3

        @eyllanesc Sorry I don't quite understand. The full code is on my github;
        https://github.com/Caedenph/integrated-bot-gui
        I thought i posted what was needed, what else would you like?

        I'm trying to reply as fast as I can but unfortunately I dont have a rep so it takes 10 minutes

        E 1 Reply Last reply 4 Sept 2021, 10:13
        0
        • C Caeden
          4 Sept 2021, 10:09

          @eyllanesc Sorry I don't quite understand. The full code is on my github;
          https://github.com/Caedenph/integrated-bot-gui
          I thought i posted what was needed, what else would you like?

          I'm trying to reply as fast as I can but unfortunately I dont have a rep so it takes 10 minutes

          E Offline
          E Offline
          eyllanesc
          wrote on 4 Sept 2021, 10:13 last edited by
          #4

          @Caeden I need an example that I can copy, paste and run that will allow me to reproduce the problem. I am not going to review a GH project since it is a lot of code that implies a lot of time that I do not want to invest. If you want help then provide what I have asked, otherwise I will go my way. Bye Bye

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          C 1 Reply Last reply 4 Sept 2021, 10:21
          0
          • E eyllanesc
            4 Sept 2021, 10:13

            @Caeden I need an example that I can copy, paste and run that will allow me to reproduce the problem. I am not going to review a GH project since it is a lot of code that implies a lot of time that I do not want to invest. If you want help then provide what I have asked, otherwise I will go my way. Bye Bye

            C Offline
            C Offline
            Caeden
            wrote on 4 Sept 2021, 10:21 last edited by
            #5

            @eyllanesc I am sorry for my misunderstanding: i'm not sure how to give a reproducible example seeing as I am using asyncqt, and nothing isnt working it was just raising a weird error. I might try and figure out another way other than QMessageBox. I was just seeing if anyone here had a similiar problem. Thanks though :)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 4 Sept 2021, 22:01 last edited by
              #6

              Hi,

              Did you try to follow the pattern of the qasync project example ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              4 Sept 2021, 09:40

              • Login

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