From 5be0b8a535f5aaffef7da65b03aafe03c4f06351 Mon Sep 17 00:00:00 2001 From: Dmitry Moiseev Date: Wed, 8 Jan 2014 01:56:33 -0800 Subject: Fix mac adress search on mac os x --- BluetoothPairedDevices.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BluetoothPairedDevices.py b/BluetoothPairedDevices.py index 8e87c3d..6f9f673 100644 --- a/BluetoothPairedDevices.py +++ b/BluetoothPairedDevices.py @@ -17,9 +17,12 @@ def ParrotZikMac(): fd = open("/Library/Preferences/com.apple.Bluetooth.plist", "rb") plist = binplist.BinaryPlist(file_obj=fd) parsed_plist = plist.Parse() - for mac in parsed_plist['PairedDevices']: - if p.match(mac.replace("-",":")): - return mac.replace("-",":") + try : + for mac in parsed_plist['PairedDevices']: + if p.match(mac.replace("-",":")): + return mac.replace("-",":") + except: + pass elif sys.platform == "win32": aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) -- cgit v1.2.1