Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
remove .lst before rename in im2rec.py (#3958)
Browse files Browse the repository at this point in the history
fout should be closed before doing anything, if it is not "WindowsError: [Error 32]" will occur.
fname should be removed before renaming fname+".tmp" to fname, if it is not "WindowsError: [Error 183]" will occur.
But why here must rewrite the lst file?

PS, My OS is Windows 10.
  • Loading branch information
Chason authored and mli committed Nov 24, 2016
1 parent 00735b2 commit 405d36a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/im2rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def write_worker(q_out, fname, working_dir):
print('time:', cur_time - pre_time, ' count:', count)
pre_time = cur_time
count += 1
fout.close()
os.remove(fname)
os.rename(fname+'.tmp', fname)

def parse_args():
Expand Down

0 comments on commit 405d36a

Please sign in to comment.