[Mailman-Users] UnicodeDecodeError accessing into web admin interface

Mark Sapiro mark at msapiro.net
Mon Nov 24 21:10:49 CET 2014


On 11/24/2014 04:05 AM, Ferriol wrote:
> 
> I'm trying to access to the web admin interface and I can't
> After authentication says "Bug in Mailman version 2.1.13"
> 
> I looked to the mailman error and read:
> admin(14653): [----- Mailman Version: 2.1.13 -----]
> admin(14653): [----- Traceback ------]
> admin(14653): Traceback (most recent call last):
> admin(14653):   File "/var/lib/mailman/scripts/driver", line 112, in
> run_main
> admin(14653):     main()
> admin(14653):   File "/var/lib/mailman/Mailman/Cgi/admin.py", line 197,
> in main
> admin(14653):     print doc.Format()
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 336,
> in Format
> admin(14653):     output.append(Container.Format(self, indent))
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 265,
> in Format
> admin(14653):     output.append(HTMLFormatObject(item, indent))
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 51,
> in HTMLFormatObject
> admin(14653):     return item.Format(indent)
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 422,
> in Format
> admin(14653):     output = output + Container.Format(self, indent+2)
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 265,
> in Format
> admin(14653):     output.append(HTMLFormatObject(item, indent))
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 51,
> in HTMLFormatObject
> admin(14653):     return item.Format(indent)
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 201,
> in Format
> admin(14653):     output = output + self.FormatRow(i, indent + 2)
> admin(14653):   File "/var/lib/mailman/Mailman/htmlformat.py", line 189,
> in FormatRow
> admin(14653):     output = output + self.FormatCell(row, i, indent + 2)
> admin(14653): UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3
> in position 71: ordinal not in range(128)


This is probably an English language list so it's Mailman character set
is us-ascii, and there is something (?) that has non-ascii, probably
utf-8 because 0xc3 is a utf-8 leadin, encoded text.

Finding exactly what is problematic.

The additional Python and environment information from the above error
log entry may help.


> If I tried access directly to the subscribers list, it works:
> https://server_name/admin/list_name/members
> 
> If I access https://server_name/admin/list_name/ crash
> Crashes too in
> https://server_name/admin/list_name/nondigest
> https://server_name/admin/list_name/topics
> All other pages of the web admin interface works
> 
> I tried to look the configuration in command line executing:
> config_list -o file list_name
> But also raises UnicodeDecodeError


And the full traceback from this may help too.


> I don't know how can I find which configuration value is the problem ?


Nor do I without some additional info.


> And when I'll find I don't know how can I fix it...


You can post one or more error log entries with the complete traceback,
python and environment info, or possibly the traceback from config_list
is even better.

Also, does this occur with all lists or only one?

Here are some suggestions:

If it occurs with only one list, if you send me off list a copy of
/var/lib/mailman/lists/LIST_NAME/config.pck, I'll try to find the problem.

You can change the code in /var/lib/mailman/Mailman/htmlformat.py around
line 189 which currently is

        for i in range(len(self.cells[row])):
            output = output + self.FormatCell(row, i, indent + 2)


and make it

        output = unicode(output, errors='replace')
        for i in range(len(self.cells[row])):
            output = output + unicode(
                self.FormatCell(row, i, indent + 2), errors='replace')
        output = output.encode(errors='replace')

This should avoid the UnicodeDecodeError and instead result in the
non-ascii characters being replaced with '?'

Alternatively, you could replace the above two lines with

        from Mailman.Logging.Syslog import syslog
        try:
            for i in range(len(self.cells[row])):
                output = output + self.FormatCell(row, i, indent + 2)
        except UnicodeDecodeError:
            syslog('error', 'UnicodeDecodeError: %s', output)

which should result in the problem bit being omitted from the page, and
Mailman's error log containing the html for the part of the page leading
up to the problem.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan


More information about the Mailman-Users mailing list