-
DescriptionInstall bleak and run a simple example from the doumentation What I DidPS C:\Users\langb\OneDrive\GitHub\Bluetooth> python -m pip install bleak Then used the code as shown in https://bleak.readthedocs.io/en/latest/scanning.html import asyncio
from bleak import BleakScanner
async def main():
devices = await BleakScanner.discover()
for d in devices:
print(d)
asyncio.run(main()) Pylance shows an error "discover" is not a known member of module, trying to run the code fails with ImportError: cannot import name 'BleakScanner' from partially initialized module 'bleak' (most likely due to a circular import) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
The actual code in the exmples folder is slightly different, but still doesn't work import asyncio
from bleak import discover
async def main():
devices = await discover()
for d in devices:
print(d)
if __name__ == "__main__":
asyncio.run(main()) Pylance objects to the |
Beta Was this translation helpful? Give feedback.
-
It sounds like you have named your file (same error as #516) |
Beta Was this translation helpful? Give feedback.
-
Ok thanks, stupid error I'll try again
Pete Barlow
…On Wed, 29 Dec 2021, 15:35 David Lechner, ***@***.***> wrote:
It sounds like you have named your file bleak.py which causes the
circular import error. Give your file a different name.
—
Reply to this email directly, view it on GitHub
<#704 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADXMVZ5FBSSLH7RUV6JG2FDUTMTC7ANCNFSM5K6E55KA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
It sounds like you have named your file
bleak.py
which causes the circular import error. Give your file a different name.(same error as #516)