Hi,
I'm getting a writeTimeout on a serial connection using pyserial here is my code.
the error i get is:
I have tried to extent both the write and the read timeout without any luck
Have anybody experienced the same problem?
i have tried the same commands in hyperterminal and it works.
Andreas
I'm getting a writeTimeout on a serial connection using pyserial here is my code.
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()
print "PDU LENGTH", pdu.length # the length of the pdu
ser.write('AT+CMGS=%d\r' % pdu.length)
print ser.readlines()
time.sleep(1)
# write the PDU and send a Ctrl+z escape
print "PDU", pdu.pdu # the pdu string
ser.write('%s\x1a' % pdu.pdu) # this i about where my app stops and throws a writeTimeout
print "sent pdu"
time.sleep(1)
print ser.readlines()
Code:
Traceback (most recent call last):
File "C:\Users\Andreas\Documents\My Dropbox\Programmering\Projects\SMSTerminal\src\SMSSender.py", line 52, in <module>
send_text('41603627', 'r'*200)
File "C:\Users\Andreas\Documents\My Dropbox\Programmering\Projects\SMSTerminal\src\SMSSender.py", line 36, in send_text
ser.write('%s\x1a\r' % pdu.pdu)
File "c:\Python26\lib\site-packages\serial\serialwin32.py", line 260, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout
Have anybody experienced the same problem?
i have tried the same commands in hyperterminal and it works.
Andreas
Comment