On 10/05/2012 04:51 AM, Luca Sanna wrote: > the code is output the error of the ubuntu > > from bluetooth import * > > target_name = "My Phone" > target_address = None > > nearby_devices = discover_devices() > > for address in nearby_devices: > if target_name == lookup_name( address ): > target_address = address > break > > if target_address is not None: > print "found target bluetooth device with address", target_address > else: > print "could not find target bluetooth device nearby" > > the error > > luca@luca-XPS-M1330:~/py-temperature/py-temperature$ python bluetooth.py > Traceback (most recent call last): > File "bluetooth.py", line 14, in <module> > from bluetooth import * > File "/home/luca/py-temperature/py-temperature/bluetooth.py", line 19, in > <module> > nearby_devices = discover_devices() > NameError: name 'discover_devices' is not defined > luca@luca-XPS-M1330:~/py-temperature/py-temperature$ > > it's a bug of the module? thanks
Perhaps you named your script bluetooth.py, and thus masked the module bluetooth.py. Pick a different name for your own sources. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list