QtBluetooth.QBluetoothDeviceDiscoveryAgent.supportedDiscoveryMethods() fails on PyQt6

Marko Luther marko.luther at gmx.net
Tue Nov 16 10:14:57 GMT 2021


Might be related to

>>> QtBluetooth.QBluetoothDeviceDiscoveryAgent.DiscoveryMethod.LowEnergyMethod
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 429, in __getattr__
    raise AttributeError(name) from None
AttributeError: LowEnergyMethod

M

> On 16. Nov 2021, at 09:37, Marko Luther <marko.luther at gmx.net> wrote:
> 
> Hi,
> 
> there seems to be another enum problem here within the latest pip version of PyQt6 (here on macOS 11.6 with BT off if this is important):
> 
> #  python3
> Python 3.9.8 (v3.9.8:bb3fdcfe95, Nov  5 2021, 17:04:07) 
> [Clang 6.0 (clang-600.0.57)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from PyQt6 import QtBluetooth
>>>> QtBluetooth.QBluetoothDeviceDiscoveryAgent.supportedDiscoveryMethods()
> ValueError: 3 is not a valid QBluetoothDeviceDiscoveryAgent.DiscoveryMethod
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 384, in __call__
>    return cls.__new__(cls, value)
>  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 709, in __new__
>    raise exc
>  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 692, in __new__
>    result = cls._missing_(value)
>  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 837, in _missing_
>    possible_member = cls._create_pseudo_member_(value)
>  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/enum.py", line 852, in _create_pseudo_member_
>    raise ValueError("%r is not a valid %s" % (value, cls.__qualname__))
> ValueError: 3 is not a valid QBluetoothDeviceDiscoveryAgent.DiscoveryMethod
> 
> 
> On PyQt5 this works as expected:
> 
> # python3
> Python 3.9.8 (v3.9.8:bb3fdcfe95, Nov  5 2021, 17:04:07) 
> [Clang 6.0 (clang-600.0.57)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from PyQt5 import QtBluetooth
>>>> QtBluetooth.QBluetoothDeviceDiscoveryAgent.supportedDiscoveryMethods()
> <PyQt5.QtBluetooth.QBluetoothDeviceDiscoveryAgent.DiscoveryMethods object at 0x7f90b6a51790>
> 
> 
> Thanks for looking into this,
> Marko



More information about the PyQt mailing list