title: i got Python: FileNotFoundError: [Errno 2] No such file or directory
body: <p>i have generated image in sequence and save in directory called <code>detected_car</code> folder, then i want to send them to JSON API like <code>https://api.generate_json/</code>, when I get json response from API it's also delete automatic with <code>os.remove("%s" %file)</code>, but it's always get that error. this is my code:</p>
  
  <pre><code>import cv2
  import os
  import json
  import requests
  import time
  
  car_count = [0]
  current_path = os.getcwd()
  file = 'detected_car/car' + str(len(car_count)) + ".png"
  path = '/home/username/Documents/path/to/image/dir%s' % file
  result = []
  
  def save_image(source_image):
      cv2.imwrite(current_path + file , source_image)
      car_count.insert(0, 1)
      with open(path, 'rb') as fp:
          response = request.post(
              'https://api.generate_json/',
              files=dict(upload=fp),
              headers={'Authorization': 'Token ' + 'KEY_API'})
          result.append(response.json())
          print(json.dumps(result, indent=2));
  
          with open('data.json', 'w') as outfile:
              json.dump(result, outfile)
      os.remove("%s" %file)
      time.sleep(1)
  </code></pre>
  
  <p>how to solve this. thankyou.</p>