os.remove (file) error windowserror: [error 32]

Remove the currently playing video while the video is playing, an error will occur.
WindowsError: [Error 32]
The process cannot access the file because another program has locked a portion of the file. When a file is opened (video is played), it cannot be renamed or deleted.
Method one:
use
Try:
except Exception,e:
raise
else:
pass
finally:
Pass the


Read More: