@contextmanager
def _tempfile(*args, **kws):
 (fd, name) = tempfile.mkstemp(*args, **kws)
 os.close(fd)
 try:
  (yield name)
 finally:
  try:
   os.remove(name)
  except OSError as e:
   if (e.errno == 2):
    pass
   else:
    raise e

@ contextmanager def _tempfile ( * args , ** kws ) : ( fd , name ) = tempfile . mkstemp ( * args , ** kws ) os . close ( fd ) try : ( yield name ) finally : try : os . remove ( name ) except OSError as e : if ( e . errno == 2 ) : pass else : raise e
context for temporary file .