Answers for "__str__ returned non-string (type"

0

__str__ returned non-string (type

django error in models.py
__str__ returned non-string (type
--------------------------------
def __str__(self):
    return self.username
Posted by: Guest on July-26-2021
0

TypeError: __str__ returned non-string (type instance)

from PIL import ImageTk as itk
background = "background.png"
'''
Don't write it this way:
photo = tk.PhotoImage(Image.open(background))
'''
# Correct way
photo = itk.PhotoImage(file = background) # Use Pillow to import .jpeg etc.
Posted by: Guest on May-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language