I'm trying to execute a python program by passing the arguments through the CSV file in the (hortonworks) shell {parameters are stored in the csv file}. When i execute the program in the (hortonworks) shell aspython program-name.py csv-filename . Its returning an error saying that

Needs more than one value to unpack

I even tried to pass the arguments directly without the csv file but its not working

program.py

from mrjob.job import MRJob
from mrjob.step import MRStep

class Patient_Records(MRJob):
    def steps(self):
        return[
                MRStep(mapper=self.mapper_get_attributes,
                       reducer=self.reducer_get_attributes)
                ]
    def mapper_get_attributes(self,_,line):
       (PATIENT_ID,GLUCOSE_LEVELS,BLOOD_PRESSURE,INSULIN,BMI,SKIN_THICKNESS)= line.split('\t')
       yield GLUCOSE_LEVELS,BLOOD_PRESSURE,INSULIN,BMI,SKIN_THICKNESS , 1

    def reducer_get_attributes(self,key,values):
        yield key, sum(values)

        if __name__=='__main__':
            Patient_Records.run()

0 Answers