def cleanup_file(tmpfile, keep_data_files=False):
if keep_data_files: return
#Remove our tmpfile, but don't fail the test if it doesn't remove
try:
os.remove(tmpfile)
except OSError as oe:
error = ""
if oe.errno: error = "%s: " % oe.errno
if oe.strerror: error += oe.strerror
if oe.filename: error += " (filename: %s)" % oe.filename
log.warning("Unable to remove powstream temporary file %s due to error reported by OS: %s" % (tmpfile, error))
except:
log.warning("Unable to remove powstream temporary file %s: %s" % (tmpfile, sys.exc_info()[0]))
##
# Handles reporting errors in pscheduler format
评论列表
文章目录