Derell Posted December 20, 2020 Report Posted December 20, 2020 Hello all, I'm new to the forum and the world of coding. I'm currently taking the beginners python 3 course. I'm on chapter 7 and I've just completed lesson 5 however I keep getting an error regarding the gif image that I saved from google. I'm certain the image is a gif file. Could there be something wrong with the image or the way it's been saved? I saved it to the desktop and a file folder. See the following error below and please advise. Thank you in advance. Derell, ========== RESTART: C:/Users/Dell/Desktop/Lessons/12.20.20_practice.py ========= Traceback (most recent call last): File "C:/Users/Dell/Desktop/Lessons/12.20.20_practice.py", line 4, in <module> python_logo = PhotoImage(file="python.gif") File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 4063, in __init__ Image.__init__(self, 'photo', name, cnf, master, **kw) File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 4008, in __init__ self.tk.call(('image', 'create', imgtype, name,) + options) _tkinter.TclError: couldn't open "python.gif": no such file or directory >>>
administrator Posted December 22, 2020 Report Posted December 22, 2020 Just the path to the file is incorrect. Python is looking for the image, but it can't find it.
Derell Posted December 23, 2020 Author Report Posted December 23, 2020 Thank you for the insight as that makes plenty of sense. Any idea on how I can correct this, or is that an entirely different topic?
Derell Posted December 23, 2020 Author Report Posted December 23, 2020 In other words, how do I change the path to the file so python can see the file? Forgive my ignorance. I'm figuring this all out slowly but surely.
administrator Posted February 1, 2021 Report Posted February 1, 2021 Oops ... I missed this. Did you figure it out? You literally move the image to match the path in your code or you change your code to properly point to the image.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now