The code piece is:
server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)
it's apparent that the listening port is occupied by someone since I can run it successfully if changing the port number from PORT_ANY to 2 or 3.
GoogleCodeExporter explains the issue, which might be caused by pnat server. Per discussion1 and discussion2, disabling pnat plugin in bluetooth config works. BEWARE that restart bluetooth service somehow doesn't work though, I have to reboot to make it enabled
in /etc/bluetooth/main.confadd/append DisablePlugins = pnatThere is still question that HOW TO FIGURE OUT WHICH SERVICE/SERVER OCCUPIED WHAT PORT!!!