simple class instantiation problem I'm having

Carl kingprad at mail.com
Thu Jan 24 17:28:51 EST 2002


I'm a newcomer to Python and have been doing pretty well. In the program I'm
working on I have a simple text-editor class I'm instantiating from a main
program. I'm getting this error:

TypeError: __init__() takes exactly 2 arguments (3 given)

when I call:

pedit = editor(root , files_to_search[choice])
(root is a Tk top-level object and the other is a simple string from a list
of strings)

the class def is this:

class editor:
    def __init__(self, rt, ifile):

If I call editor as    pedit = editor(root)   leaving off the other, it
works...yet the other is included in the __init__ definition. I can't figure
this out! Any advice is appreciated. Thanks!

Carl Scharenberg





More information about the Python-list mailing list