Python Forum

Full Version: [NEW TO PYTHON] errno 2 "no such file or directory"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.)
the image "tabitha.png" should be in the folder in which the script is located, or you must use the full path
(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!