Commit 073e3e4b authored by Sebastien Robin's avatar Sebastien Robin

genbt5list: fixed bt5 list name

was too fast in previous attempt to fix the issue
parent a4555829
...@@ -216,14 +216,15 @@ def main(dir_list=None, **kw): ...@@ -216,14 +216,15 @@ def main(dir_list=None, **kw):
for d in dir_list: for d in dir_list:
bt5list = generateInformation(d, **kw).getvalue() bt5list = generateInformation(d, **kw).getvalue()
# add pid in filename to avoid conflicts if several process calls genbt5list # add pid in filename to avoid conflicts if several process calls genbt5list
d = os.path.join(d, 'bt5list.new.%i' % os.getpid()) destination_path = os.path.join(d, 'bt5list')
temporary_path = destination_path + '.new.%i' % os.getpid()
try: try:
with open(d, 'wb') as f: with open(temporary_path, 'wb') as f:
f.write(bt5list) f.write(bt5list)
os.rename(d, 'bt5list') os.rename(temporary_path, destination_path)
finally: finally:
try: try:
os.remove(d) os.remove(temporary_path)
except OSError: except OSError:
pass pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment