title: FileNotFoundError: [Errno 2] No such file or directory: 'drone_0002_01320.jpg' -> 'drone_0002_01320.png'
body: <p>I'm trying to rename a set of files using the following code. The File is within the folder but it gives the following error. My code is attached here with:</p>
  
  <pre><code>import os
  path='absolute_path'
  arr = os.listdir(path)
  
  for i in arr:
      old_name=i
      old_name_part=old_name.split(".")
      new_name=old_name_part[0]+".png"
      print(i,'\t',old_name,'\t',new_name)
      os.rename(i,new_name)
  </code></pre>
  
  <p>Error :</p>
  
  <pre><code>drone_0002_01320.jpg     drone_0002_01320.jpg    drone_0002_01320.png
  Traceback (most recent call last):
    File "/absolute_path/rename.py", line 23, in &lt;module&gt;
      os.rename(i,new_name)
  FileNotFoundError: [Errno 2] No such file or directory: 'drone_0002_01320.jpg' -&gt; 'drone_0002_01320.png'
  </code></pre>