I spent about four hours researching the "UnicodeWarning: Unicode unequal comparison" issue. Usually, after a few hours, I'm able to answer my trickiest questions by myself, but that wasn't the case here. And I mean "tricky" for myself, of course. ;-)
I know that similar questions are answered online and also on this site, but being too noob to understand the answer well doesn't help me at all. Maybe the best way for me to get it is just having someone point out what needs to be changed in my code.
I use Python 2.5 on Windows XP.
What I was able to figure out
I understand that my problem has to do with me trying to compare apple and oranges (or Unicode and ASCII, or something like that, like maybe bytes). What I don't know is a practical way to solve this.
Here is my code:
# coding: iso-8859-1
import sys
from easygui import *
actual_answer = "pureté"
answer_given = enterbox("Type your answer!\n\nHint: 'pureté'")
if answer_given == actual_answer:
msgbox("Correct! The answer is 'pureté'")
else:
msgbox("Bug!")
Here is the error message I get:
UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal