fixed python 2.4 compatibility

nf=tempfile.NamedTemporaryFile(delete=False)
TypeError: NamedTemporaryFile() got an unexpected keyword argument 'delete'
This commit is contained in:
colynn.liu 2016-01-22 18:05:48 +08:00
parent e8427cb32a
commit 9b981cecc6

View file

@ -243,11 +243,16 @@ def main():
nf.write(new_limit)
f.close()
nf.close()
nf.flush()
# Copy tempfile to newfile
module.atomic_move(nf.name, f.name)
try:
nf.close()
except:
pass
res_args = dict(
changed = changed, msg = message
)