[Twisted-Python] twisted.web.error.Error & BaseException.message deprecation

Jason J. W. Williams jasonjwwilliams at gmail.com
Fri Mar 11 02:25:11 EST 2011

Setting it as a class level attribute seems to suppress it:

>>> class TestError(Exception):
...     message = ""
...     def __init__(self, msg):
...        self.message = msg

Since it's a string and passed by value I think this would work. I'll
open up a ticket if one's not already.


On Thu, Mar 10, 2011 at 10:12 PM, Glyph Lefkowitz
<glyph at twistedmatrix.com> wrote:
> On Mar 10, 2011, at 5:45 PM, Jason J. W. Williams wrote:
>> Hi Guys,
>> Been seeing this error for a long time and finally getting off my bum
>> to see about fixing it:
>> twisted/web/error.py:53: DeprecationWarning: BaseException.message has
>> been deprecated as of Python 2.6
>> It looks like the issue is the "self.message = message" assignment in
>> __init__: https://gist.github.com/865097
>> Before I go about getting rid of the warning, does anyone have a
>> reason Error.message should stick around?
> This is the attribute used (in some cases) to relay the protocol-level error message printed in the status line area of the HTTP response.  So yes, we need to keep it; it doesn't mean the same thing as Python's earlier 'message' attribute on Exception.  If we can simply squash the warning that would be best.
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

More information about the Twisted-Python mailing list