title: Python: Can't save file/Windows Error 32
body: <p>I have written a function which is called when my program is done with its job. </p>
  
  <pre><code>def allDone(self, event):
      dlg = wx.MessageBox("All done!", "Ask Alfred", wx.OK | wx.ICON_INFORMATION)
      os.unlink(self.fpath)
      os.rename(self.temp, self.fpath)
      self.pathBox.Clear()
  </code></pre>
  
  <p>However, its not working as expected. Its supposed to delete the original file, then rename the temp file to the original files path. </p>
  
  <p>Instead, its only executing the unlink, deleting the file at self.fpath. </p>
  
  <p>The exact error I get is:</p>
  
  <pre><code>File "G:/AskNorbert/finder.py", line 151, in allDone
  os.rename(self.temp, self.fpath)
  WindowsError: [Error 32] The process cannot access the file because it is being used by another process
  </code></pre>