If the locales package is not installed... 
"a UnicodeEncoderError" (not "an")
This line looks longer than 80 characters.