CLEAR INPUT BUFFER

Sam z.sam-No-Spam- at libero.it
Thu Oct 28 05:51:19 EDT 2004


Good day!

I have a problem with Python and the input buffer.
My application must read a barcode from PS2 and then
process it.
The problem is: i have to discard all
characters inserted in buffer while Elaborate(data)
is running.
I tried to clear the buffer using sys.stdin.flush() but
it seem not work.

proc Principale() :
  while True
    # sys.stdin.flush()
    data = sys.stdin.readline()
    Elaborate(data)


proc Elaborate() :
  sleep(5)


I'll apreciate any help!
Thanks





More information about the Python-list mailing list