File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 446, in read
ready,_,_ = select.select([self.fd],[],[], self._timeout)
error: (4, 'Interrupted system call')
This error occurs, when pyserial tries to read data from a serial device, and select returns an error.
It seems, that this can be fixed with the code from http://stackoverflow.com/questions/5633067/signal-handling-in-pylons/10306378#10306378 .
So I propose to replace serial/serialposix.py, line 446:
ready,_,_ = select.select([self.fd],[],[], self._timeout)
with
while True:
try:
ready,_,_ = select.select([self.fd],[],[], self._timeout)
except select.error, v:
if v[0] != errno.EINTR: raise
else: break
Perhaps it could be wise to add a time.sleep(0.001), to prevent 100% CPU usage, if the Interrupted system call error stays for a longer period. On the other hand this would slow down the process, if the error occurs only once.
PS: The Interrupted system call error for example occurs when opening a QFileDialog with PyQt4.
Updated file
or this:
this is an important error case to catch, because for example a modem being tested on will fail unexpectedly when it should not, just because it happens to be busy at that exact moment.
implemented a bit differently (put the try-except around the complete read block, no extra while loop needed)