NoScreamPanic
NoScreamPanic

Reputation: 11

_tkinter.TclError: couldn't recognize data in image file

Hello

So I have a Tkinter GUI'd program, that uses .png image right from start.

I use PyCharm and it works all alright with Python3 and Tkinter, without any external modules.

But when I run it from terminal I get this:

someUser@somePC:~/KeyRunner$ python3 windowLOGIN.py

Traceback (most recent call last):
File "windowLOGIN.py", line 141, in <module>
app = WindowLogin(root)
File "windowLOGIN.py", line 23, in __init__
img = tk.PhotoImage(file="keyrunnerlogo.png")
File "/home/someUser/anaconda3/lib/python3.6/tkinter/__init__.py", line 3539, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/home/someUser/anaconda3/lib/python3.6/tkinter/__init__.py", line 3495, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)

_tkinter.TclError: couldn't recognize data in image file "keyrunnerlogo.png"

If I run it with sudo it runs alright, any idea what can fix this?

Upvotes: 0

Views: 1635

Answers (1)

NoScreamPanic
NoScreamPanic

Reputation: 11

Problem was solved by uninstalling anaconda3 (that was sitting in my home directory), it had lower version of tkinter and python imported it instead of a better one.

I think it could've been solved by updating anaconda3 packages, but it was unnecessary for me.

Thanks to @Lafexlos for telling me to check versions.

Upvotes: 1

Related Questions