Missing import for flush() on windows
Brought to you by:
cliechti
flush() is broken in serialwin32.py because module time is not imported.
The sleep call is usueally skipped, as writeTimeout is None by default, but when writeTimeout is 0 the problem occurs.
Workaround: replace the flush function in your own code:
def flush_workaround(self): import time while self.outWaiting(): time.sleep(0.05) # Fix broken pyserial Serial.flush = flush_workaround
fix comitted to https://github.com/pyserial/pyserial