Posts: 74
Joined: Fri Oct 13, 2017 7:39 am

pyBluez question

Wed Jan 03, 2018 9:44 am


(I have asked same question over at the Python forum, but without succes)
I'm using a RPi 3 and Python 3.5, to try and exchange data between the RPi and my laptop (win 10).
I've installed pyBluez succesfully and downloaded a simple prog. (see below)
When i run it i keep getting an error message (see TrackBack below)

Extensive google searching leads me to believe that is it a python 2.7 <> 3.5 prob.
I get suggestions to change triggers in files that i can't seem to find ...etc

The question is simple: is there a better way to exchange Bluetooth data than pyBluez ?
Is anybody using python 3.5 with pyBluez at all?

Edit: i was succesful in pairing the RPi with the laptop via the Pi terminal window, so no prob there.


Code: Select all

import bluetooth
target_name = "HP-PDA"
target_address = None
nearby_devices = bluetooth.discover_devices() 
for bdaddr in nearby_devices:
    if target_name == bluetooth.lookup_name( bdaddr ):
        target_address = bdaddr
if target_address is not None:
    print("found target bluetooth device with address ", target_address)
    print("could not find target bluetooth device nearby")
Traceback (most recent call last):
File "/home/pi/bluetooth/blueFinder.py", line 1, in <module>
import bluetooth
File "/usr/local/lib/python3.5/dist-packages/bluetooth/__init__.py", line 45, in <module>
from bluetooth.bluez import *
File "/usr/local/lib/python3.5/dist-packages/bluetooth/bluez.py", line 10, in <module>
import bluetooth._bluetooth as _bt
ImportError: /usr/local/lib/python3.5/dist-packages/bluetooth/_bluetooth.so: undefined symbol: PyString_FromStringAndSize

Return to “Beginners”

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 34 guests