TypeError: no arguments expected
bonono at gmail.com
bonono at gmail.com
Sun Dec 11 22:11:07 EST 2005
shawn a wrote:
> I havet these 2 files in the same dir. This is code im writing to learn pythong
> mkoneurl.py:
> #! /usr/bin/env python
>
> import make_ou_class
>
> run = make_ou_class.makeoneurl()
>
> ====================================
> make_ou_class.py:
>
> class makeoneurl:
> def __init__():
> self.commandline()
>
> def commandline():
> com = raw_input(":")
> #Parse out any params and aguements - reg expressions
> #params[] array to hold paramters
> params = 0
> if com == "ou":
> self.ou(params)
> else:
> print com + " unknown command."
>
> def ou(params):
> print "hello world"
> self.commandline()
>
> ===============================================
> when i run the script like this: python mkoneurl.py
> I get this error:
>
> Traceback (innermost last):
> File "mkoneurl.py", line 5, in ?
> run = make_ou_class.makeoneurl()
> TypeError: no arguments expected
>
> Ive looked around for this exeption but nothing ive read has help in
> this situation.
> Any of your thoughts are greatly apprectiated. THANK!!
>
put "self" as the first argument in all instance methods of that class.
"self" is just a convention, referring to the object instance, not a
language feature as in other language like javascript. You can call it
"me" too if you prefer.
More information about the Python-list
mailing list