Closed rmeganck1 closed 7 years ago
I just did a quick scan of your code, so I could be wrong, but I think you need to join path
and the image file names before passing the string to image2pixelarray
. So when you try to load the image, you should give a full path name.
I'm getting the following error when I try to submit problem 5. When I run my code on the test images, it seems to load them fine. Attached is my code.
File "C:/Users/Rita/Documents/GitHub/Excision/results/5/image_proc.py", line 27, in
images = [image2pixelarray(f) for dirpath, dirnames, filenames in os.walk(path) for f in filenames if f.endswith(".png")]
File "C:/Users/Rita/Documents/GitHub/Excision/results/5/image_proc.py", line 27, in
images = [image2pixelarray(f) for dirpath, dirnames, filenames in os.walk(path) for f in filenames if f.endswith(".png")]
File "C:/Users/Rita/Documents/GitHub/Excision/results/5/image_proc.py", line 12, in image2pixelarray
im = Image.open(file).convert('L')
File "C:\Users\Rita\Anaconda3\lib\site-packages\PIL\Image.py", line 2312, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'image_000.png'
image_proc.txt