これが失敗する理由を知る必要があります:
class ConfigurationError(Exception):
def __init__(self, *args):
super(ConfigurationError, self).__init__(self, args)
self.args = list(args)
# Do some formatting on the message string stored in self.args[0]
self.args[0]=self.__prettyfi(self.args[0])
def __prettyfi(self, arg):
pass
# Actual function splits message at word
# boundaries at pos rfind(arg[1:78]) if len(arg) >78
# it does this by converting a whitespace char to a \n
コードを実行すると、次のメッセージが表示されます。
<snip>
ConfigurationError.py", line 7, in __init__
self.args[0]=self.__prettyfi(self.args[0])
TypeError: 'tuple' object does not support item assignment
行番号を編集しました。このコード サンプルと一致するようにします。
self.args = list(args)
5 行目のリストにタプルを正しく展開しない理由がわかりません。
(超基本的なことを覚えていないのではないかとこっそり疑っています...)