title: Absolute path in python function in a docker image
body: <p>I have the following function to remove scraped images from the project directory:</p>
  <pre><code>import os
  
  # Function to delete all .jpg files from project directory
  def remove_jpg():
  
      # script_dir = os.path.dirname(__file__)
      # rel_path = &quot;/Users/myname/Documents/project_directory/&quot;
      # abs_file_path = os.path.join(script_dir, rel_path)
  
      path = &quot;/Users/myname/Documents/project_directory/&quot;
      for file in os.scandir(path):
          if file.name.endswith(&quot;.jpg&quot;):
              os.unlink(file.path)
  
  # Main function ----
  if __name__ == '__main__':
      remove_jpg()
  </code></pre>
  <p>When I create my Docker image through <code>docker build -t project-test1 .</code>, and run the project in the Docker Desktop app, I always get the following error:</p>
  <p><code>FileNotFoundError: [Errno 2] No such file or directory: '/Users/myname/Documents/project_directory/'</code></p>
  <p>I have tried making the <code>path</code> variable something not absolute - but I've had no luck in getting it to run by utilizing the commented out code in the above function. Is this an issue with the <code>COPY . .</code> in the Dockerfile itself, or bad code in the function?</p>