views:

9

answers:

0

Hi,

I'm getting a writeTimeout on a serial connection using pyserial. I have googled a lot and so far i have found nothing. I thought some other might have had the same problem and solved it.

However here is my example code

ser = serial.Serial('COM10',
                    baudrate=115200,
                    timeout=2,
                    writeTimeout = 2,
                    bytesize=serial.EIGHTBITS,
                    parity=serial.PARITY_NONE,
                    stopbits=serial.STOPBITS_ONE)
ser.flushOutput()
ser.flushInput()
ser.write('AT+CMGS=%d' % pdu.length) # \r
print ser.readlines()
time.sleep(1)
# write the PDU and send a Ctrl+z escape
print "PDU", pdu.pdu
ser.write('%s\x1a' % pdu.pdu) # THIS is where i get the exeption
print "sent pdu"

Does anyone know why pySerial would throw this exception? I have tried to extent the timeout on both write and reads, but nothing helps. I have doing the same commands in hyperterminal and i worked with any trouble, but with pySerial i doesn't.

Any help would be appreciated greatly.

/Andreas