Forums

Failing to open an image

the command I run def draw_text_on_image(image_path="\home\zane100long\the_don.png", I have a script to draw image on text but I get this error

Traceback (most recent call last): File "/home/zane100long/drawer.py", line 99, in draw_text_on_image image = Image.open(image_path) File "/usr/local/lib/python3.10/site-packages/PIL/Image.py", line 2953, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: '\\home\\zane100long\\the_don.png' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/zane100long/main.py", line 2, in <module> import drawer File "/home/zane100long/drawer.py", line 179, in <module> draw_text_on_image() File "/home/zane100long/drawer.py", line 101, in draw_text_on_image raise OSError(f"Could not open image file: {image_path}") OSError: Could not open image file: \home\zane100long\the_don.png

Path should be probably /home/zane100long/the_don.png not \home\zane100long\the_don.png