On 2006-12-04, Giovanni Bajo <[EMAIL PROTECTED]> wrote: [...]
>> This should result in complete packets (from the "M" to a "\r") > > Oh well. readline(eol="\r") will do that much better. Yup. Using readline() has been suggested several times. It sure seems like the obvious solution to me as well. > while 1: > data = ser.readline(eol="\r") > args = data.split() > if args[0] == "M": > # command M; do something with args[1:] > elif args[0] == "KK": > # command KK; do something with args[1:] > [.. process other commands ..] > else: > # Invalid command: might be an incomplete > # packet. Just ignore it. > pass -- Grant Edwards grante Yow! Hmmm... A hash-singer at and a cross-eyed guy were visi.com SLEEPING on a deserted island, when... -- http://mail.python.org/mailman/listinfo/python-list