Python and Bluetooth - Mac 10.13

Issue #209 resolved
Andra Zaharia
created an issue

I'm trying to do

import bluetooth
nearby_devices = bluetooth.discover_devices(
        duration=8, lookup_names=True, flush_cache=True, lookup_class=False)

But it comes up with

2017-09-28 14:38:32.638 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.639 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.639 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.639 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.640 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.640 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.641 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.641 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.642 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.642 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.643 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
2017-09-28 14:38:32.643 Python[4035:47755] Exception NSInvalidArgumentException thrown while decoding IOBluetoothSDPServiceRecord
[1]    4035 segmentation fault  python

and breaks.

I thought it was because of pybluez, but I also tried with lightblue and it did not work. I should probably mention that it did work with lightblue prior to the 10.13 installation.

Is the 10.13 support branch still being worked on? Should I try installing that one?

Cheers!

Comments (4)

  1. Ronald Oussoren repo owner

    "import bluetooth" isn't part of PyObjC. What is the package you're trying to use (name and version)? Likewise, what Python version do you use?

    I closed the 10.13 support branch earlier today. Before that it contained the 10.13 support changes that are in PyObjC 4.0. That work has been merged in default and that branch also contains a small update for the most recent Xcode beta (nothing that would affect this issue).

    And not unimportantly: Do you have any indication on why this is a bug in PyObjC?

    I looked at the pybluez source code and it appears to use and embedded blob of Objective-C code to do much of the work, including the interesting bits of "bluetooth.discover_devices". That code may not work correctly on macOS 10.13. I'm not 100% sure of this, the pybluez build system is odd and I'm not sure what the "lightlbue" module that's referred to in the source code actually is.

  2. Andra Zaharia reporter

    Ok, thanks for the reply and for having a look at the package code :) You seem quite certain of it and no one else reported this issue, so I'll assume the problem is on the pybluez side.

  3. Log in to comment