[Tutor] serial port, revisited, but closer

shawn bright nephish at gmail.com
Wed Nov 5 15:44:40 CET 2008


Hey all,

I am back again with the serial port stuff, i have verified that all
the baud rate and settings are ok,
had my unit talk directly to a serial port reader and it is looking
good, however, i still am not seeming to be able to read this.

I had a question that might make me a clue.
if i do this:
j = ser.read(23)
f = open('filename', 'wb')
f.write(j)

when i do file from the cli in linux, the file says to contain data.
however if i do this:
i = 1
msg_list = []
while i < 23:
    msg_list.append(ser.read(1))
items = ''.join(msg_list)
f=open('filename', 'wb')
f.write(items)
f.close()

i get that the file is a binary file.

i didn't think there would be a difference.
anyway, thanks
sk


More information about the Tutor mailing list