#40 bluetooth module checking error

open
nobody
None
5
2010-01-07
2010-01-07
Anonymous
No

The logic for checking if python modules are working has a logic error. It runs 3 tests not 2 so the check on IMPORT_BT!=2 should say IMPORT_BT!=3:
start on line 96:
IMPORT_BT=0
try:
import bluetooth
IMPORT_BT = IMPORT_BT+1
except:
pass
try:
import _bluetooth as bluez
IMPORT_BT = IMPORT_BT+1
except:
pass
try:
import bluetooth._bluetooth as bluez
IMPORT_BT = IMPORT_BT+1
except:
pass
if (IMPORT_BT!=3):
print _("The program cannot import the module bluetooth.")
print _("Please make sure the bluetooth bindings for python as well as bluez are installed.")
print _("e.g. with Ubuntu Linux, type")
print _(" sudo apt-get install python-bluez")

Discussion