aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Siarkowicz <mareksiarkowicz@gmail.com>2015-06-15 15:11:43 +0200
committerMarek Siarkowicz <mareksiarkowicz@gmail.com>2015-06-15 15:11:43 +0200
commit814921eabbfb0cdc41baeb62e4b25da10c9e0212 (patch)
tree23301d51304d292994221c67106652fc34c12b1c
parent4573f9f3e95a0d79c576e3fe0f34023bbf6f0898 (diff)
downloadpyParrotZikTCP-814921eabbfb0cdc41baeb62e4b25da10c9e0212.tar.xz
pyParrotZikTCP-814921eabbfb0cdc41baeb62e4b25da10c9e0212.zip
Fix connection refused error.
-rw-r--r--parrot_zik/bluetooth_paired_devices.py5
1 files changed, 4 insertions, 1 deletions
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)