"UnicodeDecodeError" problem in Czech setup (WAS: [Spambayes] Re: Spambayes Digest, Vol 59, Issue 9)

Skip Montanaro skip at pobox.com
Sat Jul 5 14:02:17 EDT 2003


    Erik> Let me know what kind of experiments I should run.

I can think of a couple things you might try.  First, if execute the Python
interpreter from a DOS shell what is your default encoding (I suspect
ascii):

    import sys
    print sys.getdefaultencoding()

Second, I'd like to know what the arguments are to the ntpath.join()
function.  The character with ordinal 0xed (an accented 'i') is clearly not
an ASCII character, yet the error message suggests ntpath.join is being
passed string objects not Unicode objects.  In Outlook2000/manager.py you
should see a bit of code at the start of LoadConfig like this:

    def LoadConfig(self):
        profile_name = self.message_store.GetProfileName()
        if profile_name is None:
            # should only happen in source-code versions - older win32alls can't
            # determine this.
            profile_name = "unknown_profile"
        else:
            # xxx - remove me sometime - win32all grew this post 154(ish)
            # binary never released with this, so we can be a little more brutal
            # Try and rename to current profile, silent failure
            try:
                os.rename(os.path.join(self.data_directory, "unknown_profile.ini"),
                          os.path.join(self.data_directory, profile_name + ".ini"))
            except os.error:
                pass

One of those two os.path.join (aka ntpath.join on Windows) calls is what's
failing.  It would appear either your data directory or your chosen profile
name contains an accented 'i'.  One or both should be Unicode objects, not
strings.  If your system has filenames which contain non-ASCII characters I
suspect your system's default encoding needs to be set properly in
c:\Python23\site.py.

Skip



More information about the Spambayes mailing list