title: Why os.rename sometimes returns error access is denied python
body: <p>I used os.rename() method to rename the directory in my python script. This script called automatically by the scheduler every day. Sometimes the os.rename() function returns the error,</p>
  
  <pre><code> [Error 5] Access is denied
  </code></pre>
  
  <p>But all other times its working fine.
  Code, </p>
  
  <pre><code>try:
    if(os.path.exists(Downloaded_Path)):
      os.rename(Downloaded_Path, Downloaded_Path + "_ByClientTool")
  except Exception,e:
    print "Error !!", str(e)
    return 1
  </code></pre>