The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

FileNotFoundError PIL

FileNotFoundError PIL

0
Votes
1
Answer

Hello again, 
 
I’m trying to reproduce what is shown in the course but I can’t manage to open the image correctly. I downloaded it, change he name to the proper one and move it to the following folder (anaconda3\lib\site-packages\PIL) I did so because of this error shows, I thought this was the right folder, but it still doesn’t work. 
 
So the code is:
file_name = ‘hillside.jpg’
im = Image.open(file_name)
imshow(im)
 
and the error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-19-10835c69b844> in <module>
      1 file_name = 'hillside.jpg'
----> 2 im = Image.open(file_name)
      3 imshow(im)

~\anaconda3\lib\site-packages\PIL\Image.py in open(fp, mode)
   2807 
   2808     if filename:
-> 2809         fp = builtins.open(filename, "rb")
   2810         exclusive_fp = True
   2811 

FileNotFoundError: [Errno 2] No such file or directory: 'hillside.jpg'

 
Could you please help me?
Thanks!

#, #
1 Answer

0
Votes

This error states that there is no file named “Hillside” on your pc.
To correct it please write down or copy paste the path of an image from your computer and replace hillside with same.