python newbie error: TypeError: get() takes exactly 1 argument (2 given)
Ben Leslie
benno at sesgroup.net
Wed Dec 25 19:39:20 EST 2002
On Wed, 25 Dec 2002, Sean Carey wrote:
> C:\Documents and Settings\Administrator\Desktop>c:\python22\python
> script6.py
> Traceback (most recent call last):
> File "script6.py", line 4, in ?
> rah.get('http://www.google.com')
> TypeError: get() takes exactly 1 argument (2 given)
> rah.get('http://www.google.com')
>
The trick to this error message is to realise that when you call a method
on an instance, it automatically places "self" as the first paremeter, which
means that you really are passing two arguments here.
(Maybe that error emssage could be made more useful?)
> class topaz :
> def get(dataarg) :
This is where the actual bug is. You will want
class topaz:
def get(self, dataarg):
Benno
More information about the Python-list
mailing list