title: "IsADirectoryError: [Errno 21] Is a directory" when it is a file
body: <p>I tried using:</p>
  
  <pre><code>import os
  my_path = [files for pth, dirs, files in os.walk(path)]
  result_list = ['one', 'two', 'three']
  for original_path, new_name in zip(my_path, result_list):
      os.rename(original_path, 'path_to_save'.format(new_name))
  </code></pre>
  
  <p>where I get: </p>
  
  <blockquote>
    <p><code>IsADirectoryError: [Errno 21] Is a directory: 'path-of-original-path' -&gt; 'path-of-new-name'</code></p>
  </blockquote>
  
  <p>but I can confirm that 'original_path' leads to a file as on using <code>os.path.isfile</code> returns <code>True</code>.</p>
  
  <p>Any help would be highly appreciated.</p>