From 814921eabbfb0cdc41baeb62e4b25da10c9e0212 Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Mon, 15 Jun 2015 15:11:43 +0200 Subject: Fix connection refused error. --- parrot_zik/bluetooth_paired_devices.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parrot_zik/bluetooth_paired_devices.py b/parrot_zik/bluetooth_paired_devices.py index 726731c..f06286a 100644 --- a/parrot_zik/bluetooth_paired_devices.py +++ b/parrot_zik/bluetooth_paired_devices.py @@ -88,7 +88,10 @@ def connect(): host = first_match["host"] sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM) - sock.connect((host, port)) + try: + sock.connect((host, port)) + except bluetooth.btcommon.BluetoothError: + raise ConnectionFailure sock.send('\x00\x03\x00') sock.recv(1024) -- cgit v1.2.1