TypeError:me()只取2个参数(给定3个)

时间:2013-03-19 12:19:31

标签: python

我正在尝试使用supybot插件,但我一直收到错误,我无法修复(我使用Python 2.6)

这是我得到的错误:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/supybot/callbacks.py", line 1180, in _callCommand
    self.callCommand(command, irc, msg, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/supybot/utils/python.py", line 86, in g
    f(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/supybot/callbacks.py", line 1166, in callCommand
    method(irc, msg, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/supybot/commands.py", line 913, in newf
    f(self, irc, msg, args, *state.args, **state.kwargs)
  File "/usr/lib/python2.6/site-packages/supybot/plugins/Slap1/plugin.py", line 109, in slap
    self.me(irc, text)
TypeError: me() takes exactly 2 arguments (3 given)
ERROR 2013-03-19T15:13:13 supybot Exception id: 0x873c0

插件代码可以在这里找到:

https://raw.github.com/StevenRKM/supybot-plugins/master/Slap/plugin.py

请帮我解决这个问题

2 个答案:

答案 0 :(得分:4)

您的me方法具有以下签名:def me(self, msg)。它被称为self.me(irc, text),需要签名为def me(self, irc, msg)

答案 1 :(得分:2)

我认为这条消息给出了一个非常有道理的错误信息。

您使用三个参数(me()selfirc)呼叫text,而期待两个参数selfmsg )。