diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 01:56:01 +0200 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2015-06-15 01:56:01 +0200 |
commit | bd0c2445f53e8c049fe7cc4c1b4e2e0a11418bc1 (patch) | |
tree | 672a2f582fe75c9b6fb99edec977a9fc25361147 | |
parent | 8dd3e12ec52cf993856bc0ea3601cc1c07acce1b (diff) | |
download | pyParrotZikTCP-bd0c2445f53e8c049fe7cc4c1b4e2e0a11418bc1.tar.xz pyParrotZikTCP-bd0c2445f53e8c049fe7cc4c1b4e2e0a11418bc1.zip |
Ignore bluetooth error.
Diffstat (limited to '')
-rw-r--r-- | bluetooth_paired_devices.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bluetooth_paired_devices.py b/bluetooth_paired_devices.py index 5ab060f..ce86d53 100644 --- a/bluetooth_paired_devices.py +++ b/bluetooth_paired_devices.py @@ -68,7 +68,10 @@ def connect(): "8B6814D3-6CE7-4498-9700-9312C1711F63"] service_matches = [] for uuid in uuids: - service_matches = bluetooth.find_service(uuid=uuid, address=mac) + try: + service_matches = bluetooth.find_service(uuid=uuid, address=mac) + except bluetooth.btcommon.BluetoothError: + pass if service_matches: break @@ -79,14 +82,11 @@ def connect(): first_match = service_matches[0] host = first_match[0] port = first_match[1] + sock = lightblue.socket() else: first_match = service_matches[0] port = first_match["port"] host = first_match["host"] - - if sys.platform == "darwin": - sock = lightblue.socket() - else: sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM) sock.connect((host, port)) |