john@Schala:~$ python test.py Traceback (most recent call last): File "test.py", line 7, in print_name(devices[0]['host']) IndexError: list index out of range john@Schala:~$ cat test.py import bluetooth devices = bluetooth.find_service(name = 'Audio Source') def print_name(mac): for i in range(10): name = bluetooth.lookup_name(mac) print u'i = ' + str(i) + ' res = ' + str(name) print_name(devices[0]['host'])