Menu

#183 Missing import for flush() on windows

v2.7
closed-fixed
None
5
2015-08-05
2015-04-08
No

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

Discussion

  • Chris Liechti

    Chris Liechti - 2015-08-05
    • status: open --> closed-fixed
    • assigned_to: Chris Liechti
     
  • Chris Liechti

    Chris Liechti - 2015-08-05
     

Log in to post a comment.