PySerial (シリアル通信用の Python API) を使用して、ブルートゥース経由で AT コマンドを Nokia 電話に送信しています。
import serial
com = serial.Serial()
com.port = 19
com.timeout = 0 #also tried a timeout value greater than 0.
try:
com.open()
# at this point I turn off the phone.
com.write("AT\r\n")
print com.readlines()
except SerialException, e:
print e
com を open() した直後に、電話の電源を切ります。次に、("AT\r\n") と書きます。この時点で、関数がブロックされ、ランタイムがハングします。
解決策はありますか?