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. Why does calling dynamicCall and querySubObject always get an error in QAxWidget?
Forum Updated to NodeBB v4.3 + New Features

Why does calling dynamicCall and querySubObject always get an error in QAxWidget?

Scheduled Pinned Locked Moved Unsolved Qt for Python
10 Posts 3 Posters 903 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.
  • H Offline
    H Offline
    howerl
    wrote on last edited by
    #1

    The development environment is python 3.11 + pyside6. When calling dynamicCall and querySubObject, there is always an error message saying "Unexpected type: (str, int) possible type: (bytes, any)(bytes, sequence)", the code example used is as follows, please see what went wrong? Can you provide the correct call method?

    self.ax_widget2.dynamicCall("ActiveDocument.GoTo(int)", 10)

    JonBJ 1 Reply Last reply
    0
    • hskoglundH Online
      hskoglundH Online
      hskoglund
      wrote on last edited by
      #2

      Hi, you're sure it's not just a warning? i.e. the call worked but resulted in a warning.

      H 1 Reply Last reply
      0
      • H howerl

        The development environment is python 3.11 + pyside6. When calling dynamicCall and querySubObject, there is always an error message saying "Unexpected type: (str, int) possible type: (bytes, any)(bytes, sequence)", the code example used is as follows, please see what went wrong? Can you provide the correct call method?

        self.ax_widget2.dynamicCall("ActiveDocument.GoTo(int)", 10)

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

        @howerl
        Maybe it is only a warning as @hskoglund says. But if it needs to be fixed, the message seems to be telling you that you are passing a Python str for the first argument but it wants a Python bytes type. Try:

        self.ax_widget2.dynamicCall("ActiveDocument.GoTo(int)".encode('utf-8'), 10)
        

        ?

        H 1 Reply Last reply
        0
        • JonBJ JonB

          @howerl
          Maybe it is only a warning as @hskoglund says. But if it needs to be fixed, the message seems to be telling you that you are passing a Python str for the first argument but it wants a Python bytes type. Try:

          self.ax_widget2.dynamicCall("ActiveDocument.GoTo(int)".encode('utf-8'), 10)
          

          ?

          H Offline
          H Offline
          howerl
          wrote on last edited by
          #4

          @JonB i tried the code, there is no warning again, but error generated when running, the info as follow:

          self.ax_widget.dynamicCall("ActiveDocument.GoTo(int)".encode('utf-8'), 10)
          ValueError: 'PySide6.QtAxContainer.QAxBase.dynamicCall' called with wrong argument values:
          PySide6.QtAxContainer.QAxBase.dynamicCall(b'ActiveDocument.GoTo(int)', 10)
          Found signature:
          PySide6.QtAxContainer.QAxBase.dynamicCall(bytes, Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any))

          JonBJ 1 Reply Last reply
          0
          • hskoglundH hskoglund

            Hi, you're sure it's not just a warning? i.e. the call worked but resulted in a warning.

            H Offline
            H Offline
            howerl
            wrote on last edited by
            #5

            @hskoglund I'm very confused about the syntax of pyside6, there is very little information on the Internet, and I can't find a standard usage also

            1 Reply Last reply
            0
            • H howerl

              @JonB i tried the code, there is no warning again, but error generated when running, the info as follow:

              self.ax_widget.dynamicCall("ActiveDocument.GoTo(int)".encode('utf-8'), 10)
              ValueError: 'PySide6.QtAxContainer.QAxBase.dynamicCall' called with wrong argument values:
              PySide6.QtAxContainer.QAxBase.dynamicCall(b'ActiveDocument.GoTo(int)', 10)
              Found signature:
              PySide6.QtAxContainer.QAxBase.dynamicCall(bytes, Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any))

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

              @howerl said in Why does calling dynamicCall and querySubObject always get an error in QAxWidget?:

              PySide6.QtAxContainer.QAxBase.dynamicCall(b'ActiveDocument.GoTo(int)', 10)

              The b'...' makes it a bytes type, as expected. I do not know why Python says

              PySide6.QtAxContainer.QAxBase.dynamicCall(bytes, Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any))
              

              is not a matching signature for your call.

              If you are able to temporarily install PyQt6 you could try this call there and see whether it is accepted/rejected. In the past there have been cases where PyQt accepts things correctly where PySide does not.

              P.S.
              I'm not all sure this will work, but you might try

              dynamicCall(b'ActiveDocument.GoTo(int)', [ 10 ])`
              

              to see if that is accepted.

              H 1 Reply Last reply
              0
              • JonBJ JonB

                @howerl said in Why does calling dynamicCall and querySubObject always get an error in QAxWidget?:

                PySide6.QtAxContainer.QAxBase.dynamicCall(b'ActiveDocument.GoTo(int)', 10)

                The b'...' makes it a bytes type, as expected. I do not know why Python says

                PySide6.QtAxContainer.QAxBase.dynamicCall(bytes, Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any), Any = Invalid(typing.Any))
                

                is not a matching signature for your call.

                If you are able to temporarily install PyQt6 you could try this call there and see whether it is accepted/rejected. In the past there have been cases where PyQt accepts things correctly where PySide does not.

                P.S.
                I'm not all sure this will work, but you might try

                dynamicCall(b'ActiveDocument.GoTo(int)', [ 10 ])`
                

                to see if that is accepted.

                H Offline
                H Offline
                howerl
                wrote on last edited by
                #7

                @JonB I tried it in PyQt6, it looks like right. It's a weird thing that the same syntax doesn't report errors on PyQt6, but not on PySide6. And PySide6 lacks a corresponding explanation, which is simply too bad.

                JonBJ 1 Reply Last reply
                0
                • H howerl

                  @JonB I tried it in PyQt6, it looks like right. It's a weird thing that the same syntax doesn't report errors on PyQt6, but not on PySide6. And PySide6 lacks a corresponding explanation, which is simply too bad.

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

                  @howerl said in Why does calling dynamicCall and querySubObject always get an error in QAxWidget?:

                  @JonB I tried it in PyQt6, it looks like right.

                  Yes, I thought that might be the case. Indicating that what you are trying to do is in principle correct, but PySide has flaws. Did you try the [ 10 ] list argument in place of the 10 integer argument, in case PySide accepts that?

                  P.S.
                  You would need a Qt PySide person to look at this. I don't know whether it's appropriate, but I'm putting a shout-out to @CristianMaureira here, he seemed to answer a question recently implying he is a Qt in-house PySide development type?

                  H 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @howerl said in Why does calling dynamicCall and querySubObject always get an error in QAxWidget?:

                    @JonB I tried it in PyQt6, it looks like right.

                    Yes, I thought that might be the case. Indicating that what you are trying to do is in principle correct, but PySide has flaws. Did you try the [ 10 ] list argument in place of the 10 integer argument, in case PySide accepts that?

                    P.S.
                    You would need a Qt PySide person to look at this. I don't know whether it's appropriate, but I'm putting a shout-out to @CristianMaureira here, he seemed to answer a question recently implying he is a Qt in-house PySide development type?

                    H Offline
                    H Offline
                    howerl
                    wrote on last edited by
                    #9

                    @JonB Thanks!do you know where i can find docs of PySide6 for more details?

                    JonBJ 1 Reply Last reply
                    0
                    • H howerl

                      @JonB Thanks!do you know where i can find docs of PySide6 for more details?

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

                      @howerl
                      There are no docs with extra details.... Things are supposed to work in principle as from C++, and the PySide docs are mostly translations from that.

                      1 Reply Last reply
                      0
                      • JonBJ JonB referenced this topic on

                      • Login

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