Issue
import os
from PIL import Image
path='D:/SomeExperiments/KITTRawData/2011_09_26/2011_09_26_drive_0091_sync/image_03/data/0000000100.jpg'
with open(path,'rb') as f:
pass
error as below
[Errno 2] No such file or directory: 'D:/SomeExperiments/KITTRawData/2011_09_26/2011_09_26_drive_0091_sync/image_03/data/0000000224.jpg'
but I can find this path on my computer:
Solution
Possible solution
Hold the shift
key and right click on the image file. Select copy as path
. Then paste the copied path into your python script. This SHOULD work for sure.
Possible reasons for the error
You are using slashes instead of backslashes - My version of windows and python supports using slashes but I'm not sure if it supports all.
File extension mismatch - Maybe your files are
.jpeg
and yet you are trying.jpg
in your script. Path is not case sensitive in Windows but it's always a good practice to use correct case in the path, for example if your file isaBc.TXT
you should use the exact same name notabc.txt
.
Answered By - Kavindu Pasan Kavithilaka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.