Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no module named bluepy.btle and no attrivbute "DefaultDelegate" #480

Open
lonxx94 opened this issue Apr 27, 2022 · 2 comments
Open

no module named bluepy.btle and no attrivbute "DefaultDelegate" #480

lonxx94 opened this issue Apr 27, 2022 · 2 comments

Comments

@lonxx94
Copy link

lonxx94 commented Apr 27, 2022

Hi everyone,

I try to use bluepy, my code has worked before but now i have an error.

I use "import bluepy.btle as btle"

I have setup a new Raspberry Pi3 , installed bluepy with "pip3 install bluepy", but when i try to launch my python script, I have an error that say "no module named bluepy.btle". I've tried to reinstall bluepy, but it's the same error.

So i have tried ''import bluepy as btle" , it works but now i have an other error which is "bluepy has no attribute 'DefaultDelegate'"

Do someone has the same problem ? It seems that bluepy is not installed correctly, or something like that.

Thanks for your answers, and sorry for my poor english.

@maciej-napora
Copy link

maciej-napora commented May 16, 2022

Hi,

It looks like python is unable to find the module files. Not much to do with the library itself.

Try:

import sys
print(sys.path)

To see the paths where the interpreter is looking for the bluepy library. There should be an entry like this leading to the bluepy module files 'btle.py' (at least on my Pi):
/usr/local/lib/python3.9/dist-packages/bluepy-1.3.0-py3.9.egg/bluepy

If you find your bluepy installation directory and add it to sys.path you will be able to do e.g. ''from bluepy.btle import Scanner".

@technomav
Copy link

the issue is with installations, lke if you install bluepy by sudo and try to find link of the just python then you do not find bluepy.
when you use sudo python then you will find bluepy.
i say bluepy is king of sudo library which direct intract with hardware interface with bluez so install with sudo and use with sudo python.
You can also use without sudo means install and run without sudo but in restriced permission device you will face some issues.
i recommend to use with sudo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants