title: Python PIL open image from specific file
body: <p>I'm getting to grips with the Pillow library from Python. I have a folder (folder 1) where the code is stored and within that folder another folder (folder 2) where all the pictures I would like to edit/manipulate are.</p>
  
  <p>However, I have only been able to access the images when they are saved in folder 1, but not when they are only saved in folder 2.</p>
  
  <p>I have used the code:</p>
  
  <pre><code>from PIL import Image
  import os
  
  for k in os.listdir('.'):
      if k.endswith('.jpg'):
          i = Image.open(k)
          kn, kext = os.path.splitext(k)
          print(kn)
  </code></pre>
  
  <p>Which prints the names of all the file names minus the '.jpg' extension:</p>
  
  <pre><code>MeisJeMetDeParel
  StarryNight
  TheSonOfMan
  </code></pre>
  
  <p>I have then tried to do the same, only accessing the images from inside their own specific folder:</p>
  
  <pre><code>for k in os.listdir('testPictures'):
      if k.endswith('.jpg'):
          i = Image.open(k)
          kn, kext = os.path.splitext(k)
          print(kn)
  </code></pre>
  
  <p>by changing the directory to the name of the folder they are stored in (testPictures). However, I get the error:</p>
  
  <pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'MeisJeMetDeParel.jpg'
  </code></pre>
  
  <p>So it seems that the image within the folder is being accessed, as it has been able to identify the name of the first image in the folder, yet the code is unable to print the names of the images as it was able to do so when both the code and the images were saved together. What adjustments can I make to my code so that the pictures in the testPictures folder can be printed?
  Thanks</p>