1 | initial version |
if you have a file path like:
"D:\Users\Rémy\Desktop\tipe\my.png"
python will interpret the \U
part (and the following 4 bytes) as a unicode escape sequence, also the \t
will be interpreted as a TAB -- no, you don't want that ;)
either use double backslashes:
"D:\\Users\\Rémy\\Desktop\\tipe\\my.png"
or single forward ones (even on windows !)
"D:/Users/Rémy/Desktop/tipe/my.png"
or make a "raw" string of it:
r"D:\Users\Rémy\Desktop\tipe\my.png"
last, just saying, even IF your name is Rémy, it's rarely a good idea, to have such things as an é
in a filepath, also rather try to avoid spaces in your filenames (it's all "asking for trouble" !)
2 | No.2 Revision |
if you have a file path like:
"D:\Users\Rémy\Desktop\tipe\my.png"
python will interpret the \U
part (and the following 4 bytes) as a unicode escape sequence, also the \t
will be interpreted as a TAB -- no, you don't want that ;)
either use double backslashes:
"D:\\Users\\Rémy\\Desktop\\tipe\\my.png"
or single forward ones (even on windows !)
"D:/Users/Rémy/Desktop/tipe/my.png"
or make a "raw" string of it:
r"D:\Users\Rémy\Desktop\tipe\my.png"
then, you ALWAYS have to CHECK the outcome from imread():
img = imread(...)
if not img:
# fail, you can't go on !
last, just saying, even IF your name is Rémy, it's rarely a good idea, to have such things as an é
in a filepath, also rather try to avoid spaces in your filenames (it's all "asking for trouble" !)