def retry_on_eintr(function, *args, **kw):
 while True:
  try:
   return function(*args, **kw)
  except IOError as e:
   if (e.errno != errno.EINTR):
    raise

def retry_on_eintr ( function , * args , ** kw ) : while True : try : return function ( * args , ** kw ) except IOError as e : if ( e . errno != errno . EINTR ) : raise
run a function and retry it while getting eintr errors .