Missing 1 required positional argument when calling a class function

I am missing something. Below is a simplified version of my code. I have a class

class CasaDataSet:
    def __init__(self):
        self.Data=[]

    def FromLines(self, lines, numaddlparamspec):        
        self.BlockIdentifier = lines[0]
        self.SampleIdentifier = lines[1]

      

and so on, and in another class

class CasaFile:
    def __init__(self):        
        self.Institution = 'Not Specified'        

    def ReadFile(self, Infile):
        lines = CodeThatMakesLines(Infile)
        numaddlparamspec = 2
        CDS = CasaDataSet()
        CDS.FromLines(lines, numaddlparamspec)

      

But when I call

CF = CasaFile()
CF.ReadFile('myfile.vms')

      

I get the error "TypeError: FromLines () is missing 1 required positional argument: 'numaddlparamspec'". When I google it, the answer seems to be that they forgot the parentheses after instantiation (but I don't think this is happening here?). It's in Python 3.4. Sorry if this is cheating, but I seem to have tried every permutation with and without parentheses.

+3


source to share





All Articles