ValueErrors: need more than 3 values to unpack - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: ValueErrors: need more than 3 values to unpack (/thread-4664.html) |
ValueErrors: need more than 3 values to unpack - mikerosz94 - Sep-01-2017 the goal of this code is to match year_link and tla_2 and output variables from_, to, digit, name2, min_value, max_value . I am using a CSV file, that's where the data is being read from. It is posted here:[attachment=237] Unfortunately I receive this error:
data = list(csv.reader(open(LOAD_GEN_DATAFILE))) year = raw_input(" ") location=raw_input(" ") for row in data: year_link, from_,to,digit,name2,tla_2,min_value,max_value,last_bus = row[7:16] year_link = year tla_2=location if year_link not in mydict: mydict[year_link]={} voltage_envelopes=mydict[year_link] if tla_2 not in voltage_envelopes: voltage_envelopes[tla_2]=[] voltage_envelopes[tla_2].append((from_,to,digit,name2,min_value,max_value)) if year_link in mydict and tla_2 in mydict[year_link]: voltage_envelopes=mydict[year_link] for from_,to,digit,name2,min_value,max_value in voltage_envelopes[tla_2]: from_=int(from_) to=int(to) min_value=float(min_value) max_value=float(max_value) digit=int(digit) output = 'From Bus #: {}\tTo Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t' print(output.format(from_, to,name2, min_value, max_value)) print("\n") #_c=psspy.getdefaultchar() #_i=psspy.getdefaultint() #_f=psspy.getdefaultreal() #psspy.two_winding_chng_4(from_,to,'%d'% digit,[_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f],[]) else: exit RE: ValueErrors: need more than 3 values to unpack - metulburr - Sep-01-2017 looks like voltage_envelopes[tla_2] has only 3 values, while you are expecting it to have 6?
|