AnnouncerPlugin failure

85 views
Skip to first unread message

Roger.Ob...@gmail.com

unread,
Nov 8, 2013, 2:13:17 AM11/8/13
to trac-...@googlegroups.com
Yesterday my Announcer Plugin decided to complain about a non-ASCII character
in a message:

2013-11-07 14:34:04,788 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/TracAnnouncer-1.0dev_r0-
py2.7.egg/announcer/api.py", line 584, in _real_send
evt)
File "/usr/lib/python2.7/site-packages/TracAnnouncer-1.0dev_r0-
py2.7.egg/announcer/distributors/mail.py", line 330, in distribute
self._do_send(transport, event, k, v, fmtdict[k])
File "/usr/lib/python2.7/site-packages/TracAnnouncer-1.0dev_r0-
py2.7.egg/announcer/distributors/mail.py", line 488, in _do_send
msgText = MIMEText(output, msg_format)
File "/usr/lib/python2.7/email/mime/text.py", line 30, in __init__
self.set_payload(_text, _charset)
File "/usr/lib/python2.7/email/message.py", line 226, in set_payload
self.set_charset(charset)
File "/usr/lib/python2.7/email/message.py", line 262, in set_charset
self._payload = self._payload.encode(charset.output_charset)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position
472: ordinal not in range(128)

I now get this for all messages. The position of the character changes, but
the character remains u'\xf6'

I am not aware of any change to the system. I haven't a clue where to look.
Any pointers?

--
Yours sincerely,

Roger Oberholtzer

Ramböll RST / Systems

Office: Int +46 10-615 60 20
Mobile: Int +46 70-815 1696
roger.ob...@ramboll.se
________________________________________

Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden
www.rambollrst.se

Craig A

unread,
Nov 8, 2013, 8:00:29 AM11/8/13
to trac-...@googlegroups.com

Roger.Ob...@gmail.com

unread,
Nov 8, 2013, 8:52:37 AM11/8/13
to trac-...@googlegroups.com
On Friday, November 08, 2013 05:00:29 AM Craig A wrote:
> Sounds similar to http://trac-hacks.org/ticket/10974

The suggested fix seemed to get my mail messages started again.

The mystery is why this showed up out of the blue. I have not modified the
Trac install. The messages that failed did not contain non-ASCII characters.
Very odd.

Roger.Ob...@gmail.com

unread,
Dec 3, 2013, 1:51:32 AM12/3/13
to trac-...@googlegroups.com
On Friday, November 08, 2013 05:00:29 AM Craig A wrote:

> Sounds similar to http://trac-hacks.org/ticket/10974

Hmm. The fix seemed to work for a while. I have not updated any part of Trac.
However, I once again no longer get e-mail announcements, and the Trac log
complains with:



2013-12-02 16:44:48,823 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/TracAnnouncer-1.0dev_r0-
py2.7.egg/announcer/api.py", line 584, in _real_send
evt)
File "/usr/lib/python2.7/site-packages/TracAnnouncer-1.0dev_r0-
py2.7.egg/announcer/distributors/mail.py", line 330, in distribute
self._do_send(transport, event, k, v, fmtdict[k])
File "/usr/lib/python2.7/site-packages/TracAnnouncer-1.0dev_r0-
py2.7.egg/announcer/distributors/mail.py", line 481, in _do_send
msgText = MIMEText(alternate_output, alt_msg_format)
File "/usr/lib/python2.7/email/mime/text.py", line 30, in __init__
self.set_payload(_text, _charset)
File "/usr/lib/python2.7/email/message.py", line 226, in set_payload
self.set_charset(charset)
File "/usr/lib/python2.7/email/message.py", line 262, in set_charset
self._payload = self._payload.encode(charset.output_charset)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position
979: ordinal not in range(128)


Why would the error go away and then come back?

Peter Suter

unread,
Dec 3, 2013, 1:03:06 PM12/3/13
to trac-...@googlegroups.com
On 03.12.2013 07:51, Roger.Ob...@gmail.com wrote:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position
> 979: ordinal not in range(128)
>
>
> Why would the error go away and then come back?
On 08.11.2013 14:52, Roger.Ob...@gmail.com wrote:
> The messages that failed did not contain non-ASCII characters.

Are you sure the messages that fail don't contain any '�' (u'\xf6')
characters?
> Sounds similar tohttp://trac-hacks.org/ticket/10974
> Hmm. The fix seemed to work for a while.
> msgText = MIMEText(alternate_output, alt_msg_format)
Did you use the entire patch from comment 2?
It seems that line would be changed different:
msgText = MIMEText(alternate_output, alt_msg_format, self._charset)

(Although I would be more confident in the fix suggested in comment 9.)

Roger.Ob...@gmail.com

unread,
Dec 4, 2013, 2:47:31 AM12/4/13
to trac-...@googlegroups.com
On Tuesday, December 03, 2013 07:03:06 PM Peter Suter wrote:
> On 03.12.2013 07:51, Roger.Ob...@gmail.com wrote:
> > UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in
> > position 979: ordinal not in range(128)
> >
> >
> > Why would the error go away and then come back?
>
> On 08.11.2013 14:52, Roger.Ob...@gmail.com wrote:
> > The messages that failed did not contain non-ASCII characters.
>
> Are you sure the messages that fail don't contain any 'ö' (u'\xf6')
> characters?

Of course some messages may contain ööåÖÖÅ and maybe others. They have always
done so. That is no change in usage. What is different is that, perhaps
depending on the phase of the moon, these messages are no longer accepted by
the Announcer plugin.

> > Sounds similar tohttp://trac-hacks.org/ticket/10974
> > Hmm. The fix seemed to work for a while.
> > msgText = MIMEText(alternate_output, alt_msg_format)
>
> Did you use the entire patch from comment 2?
> It seems that line would be changed different:
> msgText = MIMEText(alternate_output, alt_msg_format, self._charset)
>
> (Although I would be more confident in the fix suggested in comment 9.)

I did the workaround in comment 7 for Trac 1.0.1. To be honest, the various
lists of possible fixes was unclear to me. Some were suggestions that may not
have solved the issue. Some were offered out of context and did not tell where
the fix was to be applied. So I did a conservative change. I am willing to try
something else.
Reply all
Reply to author
Forward
0 new messages