noob question: "TypeError" wrong number of args

Ben Finney bignose+hates-spam at benfinney.id.au
Mon May 1 09:51:31 EDT 2006


"Holger" <ishoej at gmail.com> writes:

> ----------------------------------------------------
> TypeError: addFile() takes exactly 1 argument (2 given)
> ----------------------------------------------------
> 
> ----------------------------------------------------
> import sys
> 
> class KeyBase:
>     def addFile(file):
>         print "initialize the base with lines from this file"

You've misunderstood -- or never followed -- the tutorial, especially
how Python does object methods. Please follow the whole tutorial
through, understanding each example as you work through it. You'll
then have a solid basis of knowledge to go on with.

    <URL:http://docs.python.org/tut/>

-- 
 \     "We are not gonna be great; we are not gonna be amazing; we are |
  `\        gonna be *amazingly* amazing!"  -- Zaphod Beeblebrox, _The |
_o__)                Hitch-Hiker's Guide To The Galaxy_, Douglas Adams |
Ben Finney




More information about the Python-list mailing list