Python Forum
[NEW TO PYTHON] errno 2 "no such file or directory" - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [NEW TO PYTHON] errno 2 "no such file or directory" (/thread-31735.html)



[NEW TO PYTHON] errno 2 "no such file or directory" - arcaic_ - Dec-30-2020

Hi, sorry, it turns out that the error was caused by the compiler I was using at the time. I tried it on a separate compiler and it worked fine. Thanks!





Hi, my name's Arcaic_, i'm a Y9 Student and i'm new to Python. I'm trying to make a GUI display an image, but i keep getting the following error:

Error:
*** GUIZERO ERROR *** Image import error - '[Errno 2] No such file or directory: 'tabitha.png'' Check the file path and image type is GIF/Animated GIF/BMP/ICO/PNG/JPG/TIF
I've searched this error and every other forum or site that displays it has a solution that's way beyond my depth, and I don't understand the solution or program. Here's my code:

from guizero import App, Text, Picture

app = App("cat")
app.bg = "#FBFBD0"

wanted_text = Text(app, "this is a cat")
wanted_text.text_size = 50
wanted_text.font = "Times New Roman"

cat = Picture(app, image="tabitha.png")

app.display()
Any help I could receive on this would be really appreciated; thank you! (it may be worth mentioning that i'm programming on Raspbian.)


RE: [NEW TO PYTHON] errno 2 "no such file or directory" - Axel_Erfurt - Dec-31-2020

the image "tabitha.png" should be in the folder in which the script is located, or you must use the full path


RE: [NEW TO PYTHON] errno 2 "no such file or directory" - arcaic_ - Dec-31-2020

(Dec-31-2020, 08:50 AM)Axel_Erfurt Wrote: the image "tabitha.png" should be in the folder in which the script is located, or you must use the full path

This works, thanks!