PyQt5: How do you call a method when there is a signal with the same name












0














I'm trying to use QBluetoothDeviceDiscoveryAgent via PyQt5.



There is a signal name error. I have been able to successfully connect it (like this: self.error.connect(self.on_error)) and confirm that it is working.



However, there is also a method named error. How can you call this method in Python?



I was expecting something like error_, but I don't see anything in dir(QBluetoothDeviceDiscoveryAgent) that looks useful:



['DiscoveryMethod', 'DiscoveryMethods', 'Error', 'GeneralUnlimitedInquiry', 'InputOutputError', 'InquiryType', 'InvalidBluetoothAdapterError', 'LimitedInquiry', 'NoError', 'PoweredOffError', 'UnknownError', 'UnsupportedDiscoveryMethod', 'UnsupportedPlatformError', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'blockSignals', 'canceled', 'childEvent', 'children', 'connectNotify', 'customEvent', 'deleteLater', 'destroyed', 'deviceDiscovered', 'disconnect', 'disconnectNotify', 'discoveredDevices', 'dumpObjectInfo', 'dumpObjectTree', 'dynamicPropertyNames', 'error', 'errorString', 'event', 'eventFilter', 'findChild', 'findChildren', 'finished', 'inherits', 'inquiryType', 'installEventFilter', 'isActive', 'isSignalConnected', 'isWidgetType', 'isWindowType', 'killTimer', 'lowEnergyDiscoveryTimeout', 'metaObject', 'moveToThread', 'objectName', 'objectNameChanged', 'on_deviceDiscovered', 'on_error', 'on_finished', 'parent', 'property', 'pyqtConfigure', 'receivers', 'removeEventFilter', 'sender', 'senderSignalIndex', 'setInquiryType', 'setLowEnergyDiscoveryTimeout', 'setObjectName', 'setParent', 'setProperty', 'signalsBlocked', 'start', 'startTimer', 'staticMetaObject', 'stop', 'supportedDiscoveryMethods','thread', 'timerEvent', 'tr']









share|improve this question





























    0














    I'm trying to use QBluetoothDeviceDiscoveryAgent via PyQt5.



    There is a signal name error. I have been able to successfully connect it (like this: self.error.connect(self.on_error)) and confirm that it is working.



    However, there is also a method named error. How can you call this method in Python?



    I was expecting something like error_, but I don't see anything in dir(QBluetoothDeviceDiscoveryAgent) that looks useful:



    ['DiscoveryMethod', 'DiscoveryMethods', 'Error', 'GeneralUnlimitedInquiry', 'InputOutputError', 'InquiryType', 'InvalidBluetoothAdapterError', 'LimitedInquiry', 'NoError', 'PoweredOffError', 'UnknownError', 'UnsupportedDiscoveryMethod', 'UnsupportedPlatformError', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'blockSignals', 'canceled', 'childEvent', 'children', 'connectNotify', 'customEvent', 'deleteLater', 'destroyed', 'deviceDiscovered', 'disconnect', 'disconnectNotify', 'discoveredDevices', 'dumpObjectInfo', 'dumpObjectTree', 'dynamicPropertyNames', 'error', 'errorString', 'event', 'eventFilter', 'findChild', 'findChildren', 'finished', 'inherits', 'inquiryType', 'installEventFilter', 'isActive', 'isSignalConnected', 'isWidgetType', 'isWindowType', 'killTimer', 'lowEnergyDiscoveryTimeout', 'metaObject', 'moveToThread', 'objectName', 'objectNameChanged', 'on_deviceDiscovered', 'on_error', 'on_finished', 'parent', 'property', 'pyqtConfigure', 'receivers', 'removeEventFilter', 'sender', 'senderSignalIndex', 'setInquiryType', 'setLowEnergyDiscoveryTimeout', 'setObjectName', 'setParent', 'setProperty', 'signalsBlocked', 'start', 'startTimer', 'staticMetaObject', 'stop', 'supportedDiscoveryMethods','thread', 'timerEvent', 'tr']









    share|improve this question



























      0












      0








      0







      I'm trying to use QBluetoothDeviceDiscoveryAgent via PyQt5.



      There is a signal name error. I have been able to successfully connect it (like this: self.error.connect(self.on_error)) and confirm that it is working.



      However, there is also a method named error. How can you call this method in Python?



      I was expecting something like error_, but I don't see anything in dir(QBluetoothDeviceDiscoveryAgent) that looks useful:



      ['DiscoveryMethod', 'DiscoveryMethods', 'Error', 'GeneralUnlimitedInquiry', 'InputOutputError', 'InquiryType', 'InvalidBluetoothAdapterError', 'LimitedInquiry', 'NoError', 'PoweredOffError', 'UnknownError', 'UnsupportedDiscoveryMethod', 'UnsupportedPlatformError', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'blockSignals', 'canceled', 'childEvent', 'children', 'connectNotify', 'customEvent', 'deleteLater', 'destroyed', 'deviceDiscovered', 'disconnect', 'disconnectNotify', 'discoveredDevices', 'dumpObjectInfo', 'dumpObjectTree', 'dynamicPropertyNames', 'error', 'errorString', 'event', 'eventFilter', 'findChild', 'findChildren', 'finished', 'inherits', 'inquiryType', 'installEventFilter', 'isActive', 'isSignalConnected', 'isWidgetType', 'isWindowType', 'killTimer', 'lowEnergyDiscoveryTimeout', 'metaObject', 'moveToThread', 'objectName', 'objectNameChanged', 'on_deviceDiscovered', 'on_error', 'on_finished', 'parent', 'property', 'pyqtConfigure', 'receivers', 'removeEventFilter', 'sender', 'senderSignalIndex', 'setInquiryType', 'setLowEnergyDiscoveryTimeout', 'setObjectName', 'setParent', 'setProperty', 'signalsBlocked', 'start', 'startTimer', 'staticMetaObject', 'stop', 'supportedDiscoveryMethods','thread', 'timerEvent', 'tr']









      share|improve this question















      I'm trying to use QBluetoothDeviceDiscoveryAgent via PyQt5.



      There is a signal name error. I have been able to successfully connect it (like this: self.error.connect(self.on_error)) and confirm that it is working.



      However, there is also a method named error. How can you call this method in Python?



      I was expecting something like error_, but I don't see anything in dir(QBluetoothDeviceDiscoveryAgent) that looks useful:



      ['DiscoveryMethod', 'DiscoveryMethods', 'Error', 'GeneralUnlimitedInquiry', 'InputOutputError', 'InquiryType', 'InvalidBluetoothAdapterError', 'LimitedInquiry', 'NoError', 'PoweredOffError', 'UnknownError', 'UnsupportedDiscoveryMethod', 'UnsupportedPlatformError', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'blockSignals', 'canceled', 'childEvent', 'children', 'connectNotify', 'customEvent', 'deleteLater', 'destroyed', 'deviceDiscovered', 'disconnect', 'disconnectNotify', 'discoveredDevices', 'dumpObjectInfo', 'dumpObjectTree', 'dynamicPropertyNames', 'error', 'errorString', 'event', 'eventFilter', 'findChild', 'findChildren', 'finished', 'inherits', 'inquiryType', 'installEventFilter', 'isActive', 'isSignalConnected', 'isWidgetType', 'isWindowType', 'killTimer', 'lowEnergyDiscoveryTimeout', 'metaObject', 'moveToThread', 'objectName', 'objectNameChanged', 'on_deviceDiscovered', 'on_error', 'on_finished', 'parent', 'property', 'pyqtConfigure', 'receivers', 'removeEventFilter', 'sender', 'senderSignalIndex', 'setInquiryType', 'setLowEnergyDiscoveryTimeout', 'setObjectName', 'setParent', 'setProperty', 'signalsBlocked', 'start', 'startTimer', 'staticMetaObject', 'stop', 'supportedDiscoveryMethods','thread', 'timerEvent', 'tr']






      python pyqt pyqt5 qtbluetooth






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 19:58









      eyllanesc

      73.4k103056




      73.4k103056










      asked Nov 12 at 19:36









      David Lechner

      529513




      529513
























          1 Answer
          1






          active

          oldest

          votes


















          1














          You have to call the function directly:



          print(your_QBluetoothDeviceDiscoveryAgent.error())


          This will return a number that corresponds to the following table:



          QBluetoothDeviceDiscoveryAgent::NoError                         0   No error has occurred.
          QBluetoothDeviceDiscoveryAgent::PoweredOffError 2 The Bluetooth adaptor is powered off, power it on before doing discovery.
          QBluetoothDeviceDiscoveryAgent::InputOutputError 1 Writing or reading from the device resulted in an error.
          QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError 3 The passed local adapter address does not match the physical adapter address of any local Bluetooth device.
          QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError 4 Device discovery is not possible or implemented on the current platform. The error is set in response to a call to start(). An example for such cases are iOS versions below 5.0 which do not support Bluetooth device search at all. This value was introduced by Qt 5.5.
          QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod 5 One of the requested discovery methods is not supported by the current platform. This value was introduced by Qt 5.8.
          QBluetoothDeviceDiscoveryAgent::UnknownError 100 An unknown error has occurred.


          If you want to get the most readable text then use:



          print(your_QBluetoothDeviceDiscoveryAgent.errorString())





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268963%2fpyqt5-how-do-you-call-a-method-when-there-is-a-signal-with-the-same-name%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You have to call the function directly:



            print(your_QBluetoothDeviceDiscoveryAgent.error())


            This will return a number that corresponds to the following table:



            QBluetoothDeviceDiscoveryAgent::NoError                         0   No error has occurred.
            QBluetoothDeviceDiscoveryAgent::PoweredOffError 2 The Bluetooth adaptor is powered off, power it on before doing discovery.
            QBluetoothDeviceDiscoveryAgent::InputOutputError 1 Writing or reading from the device resulted in an error.
            QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError 3 The passed local adapter address does not match the physical adapter address of any local Bluetooth device.
            QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError 4 Device discovery is not possible or implemented on the current platform. The error is set in response to a call to start(). An example for such cases are iOS versions below 5.0 which do not support Bluetooth device search at all. This value was introduced by Qt 5.5.
            QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod 5 One of the requested discovery methods is not supported by the current platform. This value was introduced by Qt 5.8.
            QBluetoothDeviceDiscoveryAgent::UnknownError 100 An unknown error has occurred.


            If you want to get the most readable text then use:



            print(your_QBluetoothDeviceDiscoveryAgent.errorString())





            share|improve this answer


























              1














              You have to call the function directly:



              print(your_QBluetoothDeviceDiscoveryAgent.error())


              This will return a number that corresponds to the following table:



              QBluetoothDeviceDiscoveryAgent::NoError                         0   No error has occurred.
              QBluetoothDeviceDiscoveryAgent::PoweredOffError 2 The Bluetooth adaptor is powered off, power it on before doing discovery.
              QBluetoothDeviceDiscoveryAgent::InputOutputError 1 Writing or reading from the device resulted in an error.
              QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError 3 The passed local adapter address does not match the physical adapter address of any local Bluetooth device.
              QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError 4 Device discovery is not possible or implemented on the current platform. The error is set in response to a call to start(). An example for such cases are iOS versions below 5.0 which do not support Bluetooth device search at all. This value was introduced by Qt 5.5.
              QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod 5 One of the requested discovery methods is not supported by the current platform. This value was introduced by Qt 5.8.
              QBluetoothDeviceDiscoveryAgent::UnknownError 100 An unknown error has occurred.


              If you want to get the most readable text then use:



              print(your_QBluetoothDeviceDiscoveryAgent.errorString())





              share|improve this answer
























                1












                1








                1






                You have to call the function directly:



                print(your_QBluetoothDeviceDiscoveryAgent.error())


                This will return a number that corresponds to the following table:



                QBluetoothDeviceDiscoveryAgent::NoError                         0   No error has occurred.
                QBluetoothDeviceDiscoveryAgent::PoweredOffError 2 The Bluetooth adaptor is powered off, power it on before doing discovery.
                QBluetoothDeviceDiscoveryAgent::InputOutputError 1 Writing or reading from the device resulted in an error.
                QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError 3 The passed local adapter address does not match the physical adapter address of any local Bluetooth device.
                QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError 4 Device discovery is not possible or implemented on the current platform. The error is set in response to a call to start(). An example for such cases are iOS versions below 5.0 which do not support Bluetooth device search at all. This value was introduced by Qt 5.5.
                QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod 5 One of the requested discovery methods is not supported by the current platform. This value was introduced by Qt 5.8.
                QBluetoothDeviceDiscoveryAgent::UnknownError 100 An unknown error has occurred.


                If you want to get the most readable text then use:



                print(your_QBluetoothDeviceDiscoveryAgent.errorString())





                share|improve this answer












                You have to call the function directly:



                print(your_QBluetoothDeviceDiscoveryAgent.error())


                This will return a number that corresponds to the following table:



                QBluetoothDeviceDiscoveryAgent::NoError                         0   No error has occurred.
                QBluetoothDeviceDiscoveryAgent::PoweredOffError 2 The Bluetooth adaptor is powered off, power it on before doing discovery.
                QBluetoothDeviceDiscoveryAgent::InputOutputError 1 Writing or reading from the device resulted in an error.
                QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError 3 The passed local adapter address does not match the physical adapter address of any local Bluetooth device.
                QBluetoothDeviceDiscoveryAgent::UnsupportedPlatformError 4 Device discovery is not possible or implemented on the current platform. The error is set in response to a call to start(). An example for such cases are iOS versions below 5.0 which do not support Bluetooth device search at all. This value was introduced by Qt 5.5.
                QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod 5 One of the requested discovery methods is not supported by the current platform. This value was introduced by Qt 5.8.
                QBluetoothDeviceDiscoveryAgent::UnknownError 100 An unknown error has occurred.


                If you want to get the most readable text then use:



                print(your_QBluetoothDeviceDiscoveryAgent.errorString())






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 12 at 19:55









                eyllanesc

                73.4k103056




                73.4k103056






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268963%2fpyqt5-how-do-you-call-a-method-when-there-is-a-signal-with-the-same-name%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine