Python Forum
Trouble with reading csv file and putting it into a file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with reading csv file and putting it into a file
#1
I am reading a csv file. I am then putting it into a dictionary and then trying to put the Dictionary into a list. Problem is, in the file I am reading there should be 8 different dictionaries put in the list. But the only one that shows up is the last one, number 8. Anyway here is the code.
# DEFINE LOAD RACE FILE FUNCTION
def load_racefiles() :
	count = 0
	master_race_file = []
	rows = 100
	columns = 100
	horse_array = [0 for i in range(rows)] 
	file_name = StringVar()
	f_name = StringVar()
	#file_dir = (r"C:\2020")
	fd =    open("dirpath", "r") 
	file_dir = (fd.read())
	fd.close()
	os.chdir(file_dir)
	for f in os.listdir(file_dir): 
		file_name, file_ext = os.path.splitext(f)
		f_name = file_name + file_ext
		file_name = file_name.strip()[3:]
		line_counter = 0
		if file_name == Race_date and file_ext == ".jcp":
			with open(f_name, "r") as csv_file:
				csv_reader = csv.reader(csv_file)
				
				for line in csv_reader:
					
					
					

					track_name = line[0]
					race_num =  line[2]
					surface =  line[6]
					race_type =  line[8]
					purse = line[11]
					trn_starts_curmeet = line[28]
					trn_wins_curmeet = line[29]
					jock_sts_curmeet =  line[34]
					jock_wins_curmeet =  line[35]
					trn_starts_curyear = line[1146]
					trn_wins_curyear = line[1147]
					jock_sts_curyear =  line[1156]
					jock_wins_curyear =  line[1157]
					trn_starts_prevyear = line[1151]
					trn_wins_prevyear = line[1152]
					jock_sts_prevyear =  line[1161]
					jock_wins_prevyear =  line[1162]
					morn_line = line[43]
					horse_name  = line[44]
					year_of_birth = line[45]
					hstarts_todays_dist = line[64]
					hwins_todays_dist = line[65]
					hstarts_todays_track = line[69]
					hwins_todays_track = line[70]
					hstarts_turf = line[74]
					hwins_turf = line[75]
					hstarts_mud = line[79]
					hwins_mud = line[80]
					hstarts_cur_yr = line[84]
					hwins_cur_yr = line[85]
					hstarts_prev_yr = line[90]
					hwins_prev_yr = line[91]
					hstarts_life = line[96]
					hwins_life = line[97]
					days_since = line[223]
					power_rating = line[250]
					dist_yards1 = line[315]
					dist_yards2 = line[316]
					dist_yards3 = line[317]
					dist_yards4 = line[318]
					dist_yards5 = line[319]
					dist_yards6 = line[320]
					dist_yards7 = line[321]
					dist_yards8 = line[322]
					dist_yards9 = line[323]
					dist_yards10 = line[324]
					surface1 = line[325]
					surface2 = line[326]
					surface3 = line[327]
					surface4 = line[328]
					surface5 = line[329]
					surface6 = line[330]
					surface7 = line[331]
					surface8 = line[332]
					surface9 = line[333]
					surface10 = line[334]
					entrants1 =  line[345]
					entrants2 =  line[346]
					entrants3 =  line[347]
					entrants4 =  line[348]
					entrants5 =  line[349]
					entrants6 =  line[350]
					entrants7 =  line[351]
					entrants8 =  line[352]
					entrants9 =  line[353]
					entrants10 =  line[354]
					first_call1 = line[575]
					first_call2 = line[576]
					first_call3 = line[577]
					first_call4 = line[578]
					first_call5 = line[579]
					first_call6 = line[580]
					first_call7 = line[581]
					first_call8 = line[582]
					first_call9 = line[583]
					first_call10 = line[584]
					second_call1 = line[585]
					second_call2 = line[586]
					second_call3 = line[587]
					second_call4 = line[588]
					second_call5 = line[589]
					second_call6 = line[590]
					second_call7 = line[591]
					second_call8 = line[592]
					second_call9 = line[593]
					second_call0 = line[594]
					finish_Position = line[615]
					last_peed = line[845]
					speed_2back = line[846]
					speed_3back = line[847]
					bestSpeed_Life  = line[1327]
					bestSpeed_Fasttrack = line[1177]
					bestSpeed_turf = line[1178]
					bestSpeed_offtrack = line[1179]
					bestSpeed_dist = line[1180]
					race_conditions = line[15]
					todays_race_classification = line[10]
					
					

					
					h = {'track' : track_name,
					'race_number' : race_num, 
					'todays_surface' : surface,
					'race_type' : race_type, 
					'todays_purse' : purse,
					'trn_starts_curmeet' : trn_starts_curmeet,
					'trn_wins_curmeet' : trn_wins_curmeet,
					'jock_sts_curmeet' : jock_sts_curmeet,
					'jock_wins_curmeet' : jock_wins_curmeet,
					'trn_starts_prevyear' : trn_starts_prevyear,
					'trn_wins_prevyear' : trn_wins_prevyear,
					'jock_sts_prevyear' : jock_sts_prevyear,
					'jock_wins_prevyear' : jock_wins_prevyear,
					'morn_line' : morn_line,
					'horse_name' : horse_name,
					'year_of_birth' : year_of_birth,
					'hstarts_todays_dist' : hstarts_todays_dist,
					'hwins_todays_dist ' : hwins_todays_dist,
					'hstarts_todays_track' : hstarts_todays_track,
					'hwins_todays_track' :hwins_todays_track,
					'hstarts_turf' : hstarts_turf,
					'hwins_turf' : hwins_turf,
					'hstarts_mud' : hstarts_mud,
					'hwins_mud' : hwins_mud,
					'hstarts_cur_yr' : hstarts_cur_yr,
					'hwins_cur_yr' : hwins_cur_yr,
					'hstarts_prev_yr' : hstarts_cur_yr,
					'hwins_prev_yr' : hwins_cur_yr,
					'hstarts_life' : hstarts_life,
					'hwins_life' : hwins_life, 
					'days_since' : days_since,
					'power_rating' : power_rating,
					'dist_yards1' : dist_yards1,
					'dist_yards2' : dist_yards2,
					'dist_yards3' : dist_yards3,
					'dist_yards4' : dist_yards4,
					'dist_yards5' : dist_yards5,
					'dist_yards6' : dist_yards6,
					'dist_yards7' : dist_yards7,
					'dist_yards8' : dist_yards8,
					'dist_yards9' : dist_yards9,
					'dist_yards10' : dist_yards10,
					'surface1' : surface1,
					'surface2' : surface2,
					'surface3' : surface3,
					'surface4' : surface4,
					'surface5' : surface5,
					'surface6' : surface6,
					'surface7' : surface7,
					'surface8' : surface8, 
					'surface9' : surface8,
					'surface10' : surface10,
					'entrants1' : entrants1,
					'entrants2' : entrants2,
					'entrants3' : entrants3,
					'entrants4' : entrants4,
					'entrants5' : entrants5,
					'entrants6' : entrants6,
					'entrants7' : entrants7,
					'entrants8' : entrants8,
					'entrants9' : entrants9,
					'entrants10' : entrants10,
					'first_call1' : first_call1,
					'first_call2' : first_call2,
					'first_call3' : first_call3,
					'first_call4' : first_call4,
					'first_call5' : first_call5,
					'first_call6' : first_call6,
					'first_call7' : first_call7,
					'first_call8' : first_call8,
					'first_call9' : first_call9,
					'first_call10' : first_call10,
					'second_call1' : second_call1,
					'second_call2' : second_call2,
					'second_call3' : second_call3,
					'second_call4' : second_call4,
					'second_call5' : second_call5,
					'second_call6' : second_call6,
					'second_call7' : second_call7,
					'second_call8' : second_call8,
					'second_call9' : second_call9,
					'second_call0' : second_call0,
					'finish_Position' : finish_Position,
					'last_peed' : last_peed,
					'speed_2back' : speed_2back,
					'speed_3back' : speed_3back,
					'trn_starts_curyear' : trn_starts_curyear,
					'trn_wins_curyear' : trn_wins_curyear,
					'jock_sts_curyear' : jock_sts_curyear,
					'jock_wins_curyear' : jock_wins_curyear,
					'bestSpeed_Life' : bestSpeed_Life,
					'bestSpeed_Fasttrack' : bestSpeed_Fasttrack,
					'bestSpeed_turf' : bestSpeed_turf,
					'bestSpeed_offtrack' : bestSpeed_offtrack,
					'bestSpeed_dist' : bestSpeed_dist,
					'race_conditions' : race_conditions,
					'todays_race_classification' : todays_race_classification

					

 				
 						}

				master_race_file.append(h ) 
				line_counter +=1
				
	
	 					
				


	print(master_race_file)
	print(line_counter)
				         		
						
	my_labeldone= Label( text ="Downloading Complete", fg= "black", font = ("sans_serif" , 16)).place(x=500, y=500)					

  
I don't understand why just the last one prints out when I print the whole list.
Reply
#2
please show complete code, including imports.
Reply
#3
Here is the complete code.

from tkinter import *
from tkinter import ttk
import time
from  tkinter import messagebox
import glob
import os
import shutil
import csv
import array as arr
import sqlite3
import pandas as pd
import numpy as np











root = Tk()

root.title("Handifast Version 13.0")

root.iconbitmap("c:/guis/racehorse.ico")

width_of_window = 1100
height_of_window = 700
	

screen_width= root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x_coordinate = (screen_width/2) - (width_of_window/2)
y_coordinate = (screen_height/2) - (height_of_window/2)
root.geometry("%dx%d+%d+%d" % (width_of_window,height_of_window,x_coordinate,y_coordinate ))


#my_progress = ttk.Progressbar(root, orient = HORIZONTAL, length = 300, mode = 'determinate')

#my_progress.pack(pady=300)

#my_progress_label = Label(root, text = "")
#my_progress_label.pack(pady=350)




def save_path():
	global fyle_path
	fyle_path = entry_1.get()
	with open('dirpath', 'w') as f:
		f.write(fyle_path )
		

#DEFINE SAVE PATH
def setup_command():
	global entry_1


	top = Toplevel()

	width_of_window = 300
	height_of_window = 500

	screen_width= top.winfo_screenwidth()
	screen_height = top.winfo_screenheight()
	x_coordinate = (screen_width/2) - (width_of_window/2)
	y_coordinate = (screen_height/2) - (height_of_window/2)
	fyle_path = StringVar()
	entry_1 = StringVar()
	top.title("Directory Path")
	top.geometry("%dx%d+%d+%d" % (width_of_window,height_of_window,x_coordinate,y_coordinate ))
	my_label= Label(top, text= "Enter Race File Directory Path")
	my_label.pack()
	top.iconbitmap("c:/guis/racehorse.ico")
	entry_1 = Entry(top, font = ("sans_serif", 12))
	entry_1.pack()
	save_button= Button(top, text="Save Path", width = 15, command=save_path)
	save_button.place(x=85, y=100)
	
	top.mainloop()


		
	

def change_path():
	pass



def set_calc_value():
	global calc_value
	global factornames
	global factor_value
	global Factor_ypos
	global calc_valu_pos
	global factor_list
	calc_valu_pos += 25
	calc_value = Calculator_horizontal.get()
	calc_value_label=Label(factor_build,text = calc_value, fg="black",font = ("sans_serif" , 14) ).place(x=1000,y=calc_valu_pos)
	factor_value = calc_value
	
	
# SET  UP CALCULATOR SLIDER TO SET FACTOR WEIGHTS
def get_Caclulator():
	calculator= Toplevel()
	global Calculator_horizontal
	global factornames
	global calc_value
	
	width_of_window = 300
	height_of_window = 300
	screen_width= calculator.winfo_screenwidth()
	screen_height = calculator.winfo_screenheight()
	x_coordinate = (screen_width/2) - (width_of_window/2)
	y_coordinate = (screen_height/2) - (height_of_window/2)
	calculator.geometry("%dx%d+%d+%d" % (width_of_window,height_of_window,x_coordinate,y_coordinate ))
	calculator.iconbitmap("c:/guis/racehorse.ico")
	
	Calculator_horizontal = Scale(calculator, from_= -50, to = 250, length = 200, resolution = 2,orient=HORIZONTAL)
	Calculator_horizontal.place(x=50, y=60)
	
	my_label= Label(calculator, text ="Set Factor Weight", fg= "#104CD6", font = ("sans_serif" , 16)).place(x=50, y=20)

	calc_button = Button(calculator, text = "Save Weight",bg="#E2F07F", width = 15,  command = set_calc_value) 
	calc_button.place(x=90, y=125)
	


# SETUP BUTTON STRUCTURE FUNCTION  FOR FACTOR FACTORY

	

def set_drfvalue():
	
	get_Caclulator()
	global Factor_ypos
	global calc_value
	global factor
	global factor_value
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="drf", fg= "black", font = ("sans_serif" , 16)).place(x=750, y= Factor_ypos) 
	
	print(factor_value)
	print(analyst_list)
	
		
		

def set_bestspeed():

	get_Caclulator()
	global Factor_ypos
	global calc_value
	global factor_list
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos) 
	factor_list['Best Speed']= calc_value
	print(factor_list[0])
	print(calc_value)



def set_bestspeed_turf():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos) 
def set_bestspeed_Fast():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed Fast", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos) 
def set_bestspeed_Off():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed Off", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bestspeed_Dist():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed Dist", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bestspeed_last3():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed L 3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avgspeed_Last3():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Speed L 3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avgspeed_Bst2L3():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Speed B2 L3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bestCarroll_speed():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Carroll Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bestCarroll_speed_last():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Carroll Speed L3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avgCarroll_speed_last():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Carroll Speed L3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bstKlein_speed():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Klein Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bstKlein_speed_Last():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Klein Speed L3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avgKlein_speed_Last():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Klein Speed L3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_spd_3_back():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed 3 Back", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_spd_2_back():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed 2 Back", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_last_speed():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Last Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_quirin__speed_pts():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Quirin Speed Pts", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bst__cramer_speed():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Cramer Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bst__life_speed():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Lifetime Speed", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_early_pace():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Early Pace", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_late_pace():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Late Paced", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Cpmpetitive_Snap():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Cpmpetitive Snapshot", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_last_E1pace():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Last E1 Pace", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_last_E2pace():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Last E2 Pace", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_last_3E1_pace():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg L3 E1 Pace", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_last3_E2pace():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg L3 E2 Pace", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_sprint_position_strength():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Sprint Pos Strength", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def  set_route_position_strength():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Route Pos Strength", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Woods_Form():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Woods Form", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Win_Percent():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Win Percent", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_in_the_money():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="In The Money", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_days_since_raced():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Days Since Raced", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_last_finish():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Last Finish", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_stretch_pos():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Stretch Pos", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_stretch_pos_L():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="MILFORD", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Morning_Line():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Morning Line", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Avg_Earn_Dist():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Earn Dist", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Avg_Earn_T_Track():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Earn Track", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_earn_turf():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Earn Turf", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_Earn_off():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Earn Off", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_lifetime_earn():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Lifetime Earn ", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_trainer_Win_meet():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Trainer Win % Meet", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_jockey_Win():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Jockey Win % Meet", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_trainer_Win_yr():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Trainer Win % Yr", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_jockey_Win_yr():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Jockey Win % Yr", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Fast_Class():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Fast Class", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Last_Purse():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Last Purse", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_avg_purse_L3():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Avg Purse L3", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_Handi_Class():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Handi Class", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_handi_age_earn():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Handi Age Earn", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def  set_dirt_pedigree():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Dirt Pedigree", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_mud_pedigree():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Mud Pedigree", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_turf_pedigree():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Turf Pedigree", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_dist_pedigree():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Dist Pedigree", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_prime_power():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Prime Power", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_mitchell_power():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Mitchell Power", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_mitchell_pwr_speed():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Mitchell Power/Sped", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_mitchell_c_c():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Mitchell C-C", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)
def set_bestspd_2_L4():
	get_Caclulator()
	global Factor_ypos
	Factor_ypos += 25
	a_factorname= Label( factor_build, text ="Best Speed 2 L4", fg= "black", font = ("sans_serif" , 16)).place(x=750, y=Factor_ypos)

# GET ANALYST'S NAME WITH FACTOR SET
def save_analyst_name():
	global analyst_name
	global analyst_list
	global factor_list
	
	factor_label = Label(factor_build, text = 'Analyst Name', fg= 'black',font = ("sans_serif" , 14) ).place(x=800,y=120)
	analyst_name = entry_analyst_name.get()
	factor_label = Label(factor_build, text = 'Analyst Name', fg= 'black',font = ("sans_serif" , 14) ).place(x=800,y=120)
	factor_namee_label=Label(factor_build,text = analyst_name, fg="#4167E8",font = ("sans_serif" , 14) ).place(x=800,y=145)
	analyst_list[0]= analyst_name
	


def save_analyst():
	pass
	
# CREATE WINDOW TO FACILITATE USER CHOOSING FACTOR SETS.
def build_factors():
	global factor_build
	global entry_analyst_name
	global labelfactor
	global calc_value
	global factor_namee_label
	global factorname
	global factor
	global factor_location
	global calc_valu_pos
	global Factor_ypos
	global analyst_list
	global factor_list
	

	calc_valu_pos = 150
	Factor_ypos = 150
	calc_value = 0
	factor_build = Toplevel()
	analyst_list = [200]
	factor_list =  [100]
	factor_value = 0

	Labe20 = Label(factor_build, text="Factor Factory",fg="#1F51B7",font = ("sans_serif" , 16) ).pack()
	Labe21 = Label(factor_build, text="Choose Wisely Grasshopper",fg="#F31839",font = ("sans_serif" , 12) ).pack()
	labelfactor =Label(factor_build)
	entry_factors = StringVar()
	factornames = StringVar()
	factor = StringVar()
	width_of_window = 1100
	height_of_window = 700
	screen_width= factor_build.winfo_screenwidth()
	screen_height = factor_build.winfo_screenheight()
	x_coordinate = (screen_width/2) - (width_of_window/2)
	y_coordinate = (screen_height/2) - (height_of_window/2)
	factor_build.geometry("%dx%d+%d+%d" % (width_of_window,height_of_window,x_coordinate,y_coordinate ))
	factorset_label= Label( factor_build, text ="Name Your Analyst First", fg= "#F33038", font = ("sans_serif" , 12)).place(x=803, y=20)
	entry_analyst_name = Entry(factor_build, font = ("sans_serif", 12))
	entry_analyst_name.place(x=800, y=50)
	save_factorbutton= Button(factor_build, text="Save Analyst's Name", width = 15, command=save_analyst_name)
	save_factorbutton.place(x=830, y=80)
	save_analystbutton= Button(factor_build, text="Save Analyst", fg= '#F52208'  , font = ("sans_serif" , 14) ,width = 15,  command=save_analyst)
	save_analystbutton.place(x=830, y=600)
	
	#factor_label=Label(factor_build,text = factor, fg="#1F51B7",font = ("sans_serif" , 16) ).place(x=800,y=120)
	factor_build.iconbitmap("c:/guis/racehorse.ico")
	my_button20 = Button(factor_build, text = "DRF Speed",bg="#0DDA7D", width = 15,  command = set_drfvalue) 
	my_button20.place(x=10, y=25)
	my_button21 = Button(factor_build, text = "Bst Spd T-T", bg='#0DDAD7' ,width = 15, command = set_bestspeed) 
	my_button21.place(x=10, y=53)
	my_button22 = Button(factor_build, text = "Bst Spd Turf", bg="#0DDA7D",width = 15, command = set_bestspeed_turf) 
	my_button22.place(x=10, y=81)
	my_button23 = Button(factor_build, text = "Bst Spd F-T", bg='#0DDAD7',width = 15, command = set_bestspeed_Fast) 
	my_button23.place(x=10, y=109)
	my_button24 = Button(factor_build, text = "Bst Spd Off", bg="#0DDA7D",width = 15, command = set_bestspeed_Off) 
	my_button24.place(x=10, y=137)
	my_button25 = Button(factor_build, text = "Bst Spd Dist", bg='#0DDAD7',width = 15, command = set_bestspeed_Dist) 
	my_button25.place(x=10, y=165)
	my_button26 = Button(factor_build, text = "Bst Spd Last 3", bg="#0DDA7D",width = 15, command = set_bestspeed_last3) 
	my_button26.place(x=10, y=193)
	my_button27 = Button(factor_build, text = "Average Speed L3", bg='#0DDAD7',width = 15, command = set_avgspeed_Last3) 
	my_button27.place(x=10, y=221)
	my_button28 = Button(factor_build, text = "Avg Speed B2 L3", bg="#0DDA7D",width = 15, command = set_avgspeed_Bst2L3) 
	my_button28.place(x=10, y=249)
	my_button29 = Button(factor_build, text = "Bst Carroll Spd", bg='#0DDAD7',width = 15, command = set_bestCarroll_speed) 
	my_button29.place(x=10, y=277)
	my_button30 = Button(factor_build, text = "Bst Carroll Spd L", bg="#0DDA7D",width = 15, command = set_bestCarroll_speed_last)
	my_button30.place(x=10, y=305)
	my_button31 = Button(factor_build, text = "Avg Carroll Spd L", bg='#0DDAD7',width = 15, command = set_avgCarroll_speed_last)
	my_button31.place(x=10, y=333)
	my_button32 = Button(factor_build, text = "Bst Klein Spd", bg="#0DDA7D",width = 15, command = set_bstKlein_speed)
	my_button32.place(x=10, y=361)
	my_button33 = Button(factor_build, text = "Bst Klein Spd L", bg='#0DDAD7',width = 15, command = set_bstKlein_speed_Last)
	my_button33.place(x=10, y=389)
	my_button34 = Button(factor_build, text = "Avg Klein Spd L", bg="#0DDA7D",width = 15, command = set_avgKlein_speed_Last)
	my_button34.place(x=10, y=417)
	my_button35 = Button(factor_build, text = "Spd 3 Back", bg='#0DDAD7',width = 15, command = set_spd_3_back)
	my_button35.place(x=10, y=445)
	my_button36 = Button(factor_build, text = "Spd 2 Back", bg="#0DDA7D",width = 15, command = set_spd_2_back)
	my_button36.place(x=10, y=473)
	my_button37 = Button(factor_build, text = "Last Speed", bg='#0DDAD7',width = 15, command = set_last_speed)
	my_button37.place(x=10, y=501)
	my_button38 = Button(factor_build, text = "Quirin Speed Pts", bg="#0DDA7D",width = 15, command = set_quirin__speed_pts)
	my_button38.place(x=10, y=529)
	my_button39 = Button(factor_build, text = "Bst Cramer Speed",bg='#0DDAD7', width = 15, command = set_bst__cramer_speed)
	my_button39.place(x=10, y=557)
	my_button40 = Button(factor_build, text = "Bst Lifdetime Speed", bg="#0DDA7D",width = 15, command = set_bst__life_speed)
	my_button40.place(x=10, y=585)
	my_button41 = Button(factor_build, text = "Bst Spd2 L4 ", bg='#0DDAD7',width = 15, command = set_bestspd_2_L4)
	my_button41.place(x=10, y=613)
	my_button80= Button(factor_build, text = "Early Pace", bg='#0DDAD7',width = 15, command = set_early_pace)
	my_button80.place(x=10, y=641)
	my_button42 = Button(factor_build, text = "Late Pace", bg="#0DDA7D",width = 15, command = set_late_pace)
	my_button42.place(x=160, y=25)
	my_button43 = Button(factor_build, text = "Cpmpetitive Snap", bg='#0DDAD7',width = 15, command = set_Cpmpetitive_Snap)
	my_button43.place(x=160, y=53)
	my_button44 = Button(factor_build, text = "Last E1 Pace", bg="#0DDA7D",width = 15, command = set_last_E1pace)
	my_button44.place(x=160, y=81)
	my_button45 = Button(factor_build, text = "Last E2 Pace", bg='#0DDAD7',width = 15, command = set_last_E2pace)
	my_button45.place(x=160, y=109)
	my_button46 = Button(factor_build, text = "Avg Last 3-E1 Pace", bg="#0DDA7D",width = 15, command = set_avg_last_3E1_pace)
	my_button46.place(x=160, y=137)
	my_button47 = Button(factor_build, text = "Avg Last 3-E2 Pace", bg='#0DDAD7',width = 15, command = set_avg_last3_E2pace)
	my_button47.place(x=160, y=165)
	my_button48 = Button(factor_build, text = "Sprint Position Str", bg="#0DDA7D",width = 15, command = set_sprint_position_strength)
	my_button48.place(x=160, y=193)
	my_button49 = Button(factor_build, text = "Route Position Str", bg='#0DDAD7',width = 15, command = set_route_position_strength)
	my_button49.place(x=160, y=221)
	my_button50 = Button(factor_build, text = "Woods Form", bg="#0DDA7D",width = 15, command = set_Woods_Form)
	my_button50.place(x=160, y=249)
	my_button51 = Button(factor_build, text = "Win Percent", bg='#0DDAD7',width = 15, command = set_Win_Percent)
	my_button51.place(x=160, y=277)
	my_button52 = Button(factor_build, text = "In The Money", bg="#0DDA7D",width = 15, command = set_in_the_money)
	my_button52.place(x=160, y=305)
	my_button53 = Button(factor_build, text = "Days Since Raced", bg='#0DDAD7',width = 15, command = set_days_since_raced)
	my_button53.place(x=160, y=333)
	my_button54 = Button(factor_build, text = "Last Finish", bg="#0DDA7D",width = 15, command = set_last_finish)
	my_button54.place(x=160, y=361)
	my_button55 = Button(factor_build, text = "Avg Stretch Pos", bg='#0DDAD7',width = 15, command = set_avg_stretch_pos)
	my_button55.place(x=160, y=389)
	my_button56 = Button(factor_build, text = "Avg Stretch Pos L", bg="#0DDA7D",width = 15, command = set_avg_stretch_pos_L)
	my_button56.place(x=160, y=417)
	my_button57 = Button(factor_build, text = "Morning Line", bg='#0DDAD7',width = 15, command = set_Morning_Line)
	my_button57.place(x=160, y=445)
	my_button58 = Button(factor_build, text = "Avg Earn Dist", bg="#0DDA7D",width = 15, command = set_Avg_Earn_Dist)
	my_button58.place(x=160, y=473)
	my_button59= Button(factor_build, text = "Avg Earn T-Track", bg='#0DDAD7',width = 15, command = set_Avg_Earn_T_Track)
	my_button59.place(x=160, y=501)
	my_button60 = Button(factor_build, text = "Avg Earn Turf", bg="#0DDA7D",width = 15, command = set_avg_earn_turf)
	my_button60.place(x=160, y=529)
	my_button61= Button(factor_build, text = "Avg Earn Off", bg='#0DDAD7',width = 15, command = set_avg_Earn_off)
	my_button61.place(x=160, y=557)
	my_button62 = Button(factor_build, text = "Avg Lifetime Earn", bg="#0DDA7D",width = 15, command = set_avg_lifetime_earn)
	my_button62.place(x=160, y=585)
	my_button63= Button(factor_build, text = "Trainer % Cur Meet", bg='#0DDAD7',width = 15, command = set_trainer_Win_meet)
	my_button63.place(x=160, y=613)
	my_button64 = Button(factor_build, text = "Jockey % Cur Meet", bg="#0DDA7D",width = 15, command = set_jockey_Win)
	my_button64.place(x=310, y=81)
	my_button65= Button(factor_build, text = "Trainer % Cur Yr", bg='#0DDAD7',width = 15, command = set_trainer_Win_yr)
	my_button65.place(x=310, y=109)
	my_button66 = Button(factor_build, text = "Jockey % Cur Yr", bg="#0DDA7D",width = 15, command = set_jockey_Win_yr)
	my_button66.place(x=310, y=137)
	my_button67= Button(factor_build, text = "Fast Class", bg='#0DDAD7',width = 15, command = set_Fast_Class)
	my_button67.place(x=310, y=165)
	my_button68 = Button(factor_build, text = "Last Purse", bg="#0DDA7D",width = 15, command = set_Last_Purse)
	my_button68.place(x=310, y=193)
	my_button69= Button(factor_build, text = "Avg Purse L3", bg='#0DDAD7',width = 15, command = set_avg_purse_L3)
	my_button69.place(x=310, y=221)
	my_button70 = Button(factor_build, text = "Handi Class", bg="#0DDA7D",width = 15, command = set_Handi_Class)
	my_button70.place(x=310, y=249)
	my_button71= Button(factor_build, text = "Handi Age Earn", bg='#0DDAD7',width = 15, command = set_handi_age_earn)
	my_button71.place(x=310, y=277)
	my_button72 = Button(factor_build, text = "Dirt Pedigree", bg="#0DDA7D",width = 15, command = set_dirt_pedigree)
	my_button72.place(x=310, y=305)
	my_button73= Button(factor_build, text = "Mud Pedigree", bg='#0DDAD7',width = 15, command = set_mud_pedigree)
	my_button73.place(x=310, y=333)
	my_button74 = Button(factor_build, text = "Turf Pedigree", bg="#0DDA7D",width = 15, command = set_turf_pedigree)
	my_button74.place(x=310, y=361)
	my_button75= Button(factor_build, text = "Dist Pedigree", bg='#0DDAD7',width = 15, command = set_dist_pedigree)
	my_button75.place(x=310, y=389)
	my_button76 = Button(factor_build, text = "Prime Power", bg="#0DDA7D",width = 15, command = set_prime_power)
	my_button76.place(x=310, y=417)
	my_button77= Button(factor_build, text = "Mitchell Power", bg='#0DDAD7',width = 15, command = set_mitchell_power)
	my_button77.place(x=310, y=445)
	my_button78 = Button(factor_build, text = "Mitchell Pwr/Speed", bg="#0DDA7D",width = 15, command = set_mitchell_pwr_speed)
	my_button78.place(x=310, y=473)
	my_button79= Button(factor_build, text = "Mitchell C-C", bg='#0DDAD7',width = 15, command = set_mitchell_c_c)
	my_button79.place(x=310, y=501)

	















def build_analyst():
	pass

def delete_analyst():
	pass
def close_handifast():
	pass



	# DEFINE MENU
my_menu = Menu(root)
root.config(menu=my_menu)


#CREATE MENU ITEMS
file_menu = Menu(my_menu)
my_menu.add_cascade(label="Configure Program", menu=file_menu)
file_menu.add_command(label="Initialize Setup Files", command=setup_command)
file_menu.add_separator()
file_menu.add_command(label="Change File directory Path", command=change_path)
file_menu.add_separator()
file_menu.add_command(label="Build Race Analyst", command=build_factors)
#file_menu.add_command(label="Build Race Analyst", command=build_analyst)
file_menu.add_command(label="Delete Race Analyst", command=delete_analyst)
file_menu.add_separator()
file_menu.add_command(label="Close Handifast", command=close_handifast)


	



#CREATE LABELS
my_label1= Label( text ="Race Tracks", fg= "black", font = ("sans_serif" , 16)).place(x=150, y=25) 
my_label2= Label( text ="Aceptable Data Types:", fg= "black", font = ("sans_serif" , 16)). place(x=700, y=25) 
my_label3= Label(text= "***jcp",  fg= "red", font = ("sans_serif" , 16)).place(x =700, y=50)
my_label4= Label(text= "***drf",  fg= "blue", font = ("sans_serif" , 16)).place(x =775, y=50)
my_label5= Label(text= "***mcp",  fg= "brown", font = ("sans_serif" , 16)).place(x =850, y=50)
my_label6= Label(text= "Enter Date",  fg= "black", font = ("sans_serif" , 16)).place(x =450, y=25)



# CREATE DATE ENTRY  FUNCTION
def  enter_racedate():
	global Race_date
	Race_date = StringVar()
	Race_date = e.get()
	

#CREATE DATE INPUT WIDGET
e = Entry(root, font= ("sans_serif", 12))
e.place(x=415, y=65)


#CREATE ENTER RACEDATE BUTTON
my_button = Button(root, text = "Enter", width = 15, command=enter_racedate)
my_button.place(x=443, y=100)



def initialize_dict():
	track_name = line[0]
	race_num =  line[2]
	surface =  line[6]


	# LOAD HORSE INFO INTO ARRAY

	
 	
 	

# DEFINE LOAD RACE FILE FUNCTION
def load_racefiles() :
	count = 0
	master_race_file = []
	rows = 100
	columns = 100
	horse_array = [0 for i in range(rows)] 
	file_name = StringVar()
	f_name = StringVar()
	#file_dir = (r"C:\2020")
	fd =    open("dirpath", "r") 
	file_dir = (fd.read())
	fd.close()
	os.chdir(file_dir)
	for f in os.listdir(file_dir): 
		file_name, file_ext = os.path.splitext(f)
		f_name = file_name + file_ext
		file_name = file_name.strip()[3:]
		line_counter = 0
		if file_name == Race_date and file_ext == ".jcp":
			with open(f_name, "r") as csv_file:
				csv_reader = csv.reader(csv_file)
				
				for line in csv_reader:
					
					
					

					track_name = line[0]
					race_num =  line[2]
					surface =  line[6]
					race_type =  line[8]
					purse = line[11]
					trn_starts_curmeet = line[28]
					trn_wins_curmeet = line[29]
					jock_sts_curmeet =  line[34]
					jock_wins_curmeet =  line[35]
					trn_starts_curyear = line[1146]
					trn_wins_curyear = line[1147]
					jock_sts_curyear =  line[1156]
					jock_wins_curyear =  line[1157]
					trn_starts_prevyear = line[1151]
					trn_wins_prevyear = line[1152]
					jock_sts_prevyear =  line[1161]
					jock_wins_prevyear =  line[1162]
					morn_line = line[43]
					horse_name  = line[44]
					year_of_birth = line[45]
					hstarts_todays_dist = line[64]
					hwins_todays_dist = line[65]
					hstarts_todays_track = line[69]
					hwins_todays_track = line[70]
					hstarts_turf = line[74]
					hwins_turf = line[75]
					hstarts_mud = line[79]
					hwins_mud = line[80]
					hstarts_cur_yr = line[84]
					hwins_cur_yr = line[85]
					hstarts_prev_yr = line[90]
					hwins_prev_yr = line[91]
					hstarts_life = line[96]
					hwins_life = line[97]
					days_since = line[223]
					power_rating = line[250]
					dist_yards1 = line[315]
					dist_yards2 = line[316]
					dist_yards3 = line[317]
					dist_yards4 = line[318]
					dist_yards5 = line[319]
					dist_yards6 = line[320]
					dist_yards7 = line[321]
					dist_yards8 = line[322]
					dist_yards9 = line[323]
					dist_yards10 = line[324]
					surface1 = line[325]
					surface2 = line[326]
					surface3 = line[327]
					surface4 = line[328]
					surface5 = line[329]
					surface6 = line[330]
					surface7 = line[331]
					surface8 = line[332]
					surface9 = line[333]
					surface10 = line[334]
					entrants1 =  line[345]
					entrants2 =  line[346]
					entrants3 =  line[347]
					entrants4 =  line[348]
					entrants5 =  line[349]
					entrants6 =  line[350]
					entrants7 =  line[351]
					entrants8 =  line[352]
					entrants9 =  line[353]
					entrants10 =  line[354]
					first_call1 = line[575]
					first_call2 = line[576]
					first_call3 = line[577]
					first_call4 = line[578]
					first_call5 = line[579]
					first_call6 = line[580]
					first_call7 = line[581]
					first_call8 = line[582]
					first_call9 = line[583]
					first_call10 = line[584]
					second_call1 = line[585]
					second_call2 = line[586]
					second_call3 = line[587]
					second_call4 = line[588]
					second_call5 = line[589]
					second_call6 = line[590]
					second_call7 = line[591]
					second_call8 = line[592]
					second_call9 = line[593]
					second_call0 = line[594]
					finish_Position = line[615]
					last_peed = line[845]
					speed_2back = line[846]
					speed_3back = line[847]
					bestSpeed_Life  = line[1327]
					bestSpeed_Fasttrack = line[1177]
					bestSpeed_turf = line[1178]
					bestSpeed_offtrack = line[1179]
					bestSpeed_dist = line[1180]
					race_conditions = line[15]
					todays_race_classification = line[10]
					
					

					
					h = {'track' : track_name,
					'race_number' : race_num, 
					'todays_surface' : surface,
					'race_type' : race_type, 
					'todays_purse' : purse,
					'trn_starts_curmeet' : trn_starts_curmeet,
					'trn_wins_curmeet' : trn_wins_curmeet,
					'jock_sts_curmeet' : jock_sts_curmeet,
					'jock_wins_curmeet' : jock_wins_curmeet,
					'trn_starts_prevyear' : trn_starts_prevyear,
					'trn_wins_prevyear' : trn_wins_prevyear,
					'jock_sts_prevyear' : jock_sts_prevyear,
					'jock_wins_prevyear' : jock_wins_prevyear,
					'morn_line' : morn_line,
					'horse_name' : horse_name,
					'year_of_birth' : year_of_birth,
					'hstarts_todays_dist' : hstarts_todays_dist,
					'hwins_todays_dist ' : hwins_todays_dist,
					'hstarts_todays_track' : hstarts_todays_track,
					'hwins_todays_track' :hwins_todays_track,
					'hstarts_turf' : hstarts_turf,
					'hwins_turf' : hwins_turf,
					'hstarts_mud' : hstarts_mud,
					'hwins_mud' : hwins_mud,
					'hstarts_cur_yr' : hstarts_cur_yr,
					'hwins_cur_yr' : hwins_cur_yr,
					'hstarts_prev_yr' : hstarts_cur_yr,
					'hwins_prev_yr' : hwins_cur_yr,
					'hstarts_life' : hstarts_life,
					'hwins_life' : hwins_life, 
					'days_since' : days_since,
					'power_rating' : power_rating,
					'dist_yards1' : dist_yards1,
					'dist_yards2' : dist_yards2,
					'dist_yards3' : dist_yards3,
					'dist_yards4' : dist_yards4,
					'dist_yards5' : dist_yards5,
					'dist_yards6' : dist_yards6,
					'dist_yards7' : dist_yards7,
					'dist_yards8' : dist_yards8,
					'dist_yards9' : dist_yards9,
					'dist_yards10' : dist_yards10,
					'surface1' : surface1,
					'surface2' : surface2,
					'surface3' : surface3,
					'surface4' : surface4,
					'surface5' : surface5,
					'surface6' : surface6,
					'surface7' : surface7,
					'surface8' : surface8, 
					'surface9' : surface8,
					'surface10' : surface10,
					'entrants1' : entrants1,
					'entrants2' : entrants2,
					'entrants3' : entrants3,
					'entrants4' : entrants4,
					'entrants5' : entrants5,
					'entrants6' : entrants6,
					'entrants7' : entrants7,
					'entrants8' : entrants8,
					'entrants9' : entrants9,
					'entrants10' : entrants10,
					'first_call1' : first_call1,
					'first_call2' : first_call2,
					'first_call3' : first_call3,
					'first_call4' : first_call4,
					'first_call5' : first_call5,
					'first_call6' : first_call6,
					'first_call7' : first_call7,
					'first_call8' : first_call8,
					'first_call9' : first_call9,
					'first_call10' : first_call10,
					'second_call1' : second_call1,
					'second_call2' : second_call2,
					'second_call3' : second_call3,
					'second_call4' : second_call4,
					'second_call5' : second_call5,
					'second_call6' : second_call6,
					'second_call7' : second_call7,
					'second_call8' : second_call8,
					'second_call9' : second_call9,
					'second_call0' : second_call0,
					'finish_Position' : finish_Position,
					'last_peed' : last_peed,
					'speed_2back' : speed_2back,
					'speed_3back' : speed_3back,
					'trn_starts_curyear' : trn_starts_curyear,
					'trn_wins_curyear' : trn_wins_curyear,
					'jock_sts_curyear' : jock_sts_curyear,
					'jock_wins_curyear' : jock_wins_curyear,
					'bestSpeed_Life' : bestSpeed_Life,
					'bestSpeed_Fasttrack' : bestSpeed_Fasttrack,
					'bestSpeed_turf' : bestSpeed_turf,
					'bestSpeed_offtrack' : bestSpeed_offtrack,
					'bestSpeed_dist' : bestSpeed_dist,
					'race_conditions' : race_conditions,
					'todays_race_classification' : todays_race_classification

					

 				
 						}

				master_race_file.append(h ) 
				line_counter +=1
				
	
	 					
				


	print(master_race_file)
	print(line_counter)
				         		
						
	my_labeldone= Label( text ="Downloading Complete", fg= "black", font = ("sans_serif" , 16)).place(x=500, y=500)					


			#print(todays_race_classification)
	

my_button1 = Button(root, text = "Load Race Files", width = 15, command = load_racefiles) 
my_button1.place(x=443, y=150)




root.mainloop()
Reply
#4
I just needed to move the list indentation one spot to the right.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  file open "file not found error" shanoger 8 946 Dec-14-2023, 08:03 AM
Last Post: shanoger
Sad problems with reading csv file. MassiJames 3 559 Nov-16-2023, 03:41 PM
Last Post: snippsat
  trouble reading string/module from excel as a list popular_dog 0 384 Oct-04-2023, 01:07 PM
Last Post: popular_dog
  Need to replace a string with a file (HTML file) tester_V 1 699 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  Reading a file name fron a folder on my desktop Fiona 4 851 Aug-23-2023, 11:11 AM
Last Post: Axel_Erfurt
  How can I change the uuid name of a file to his original file? MaddoxMB 2 874 Jul-17-2023, 10:15 PM
Last Post: Pedroski55
  Trouble with threading and reading variable from a different script Lembas 14 2,841 Apr-26-2023, 11:21 PM
Last Post: Lembas
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,046 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Reading a file JonWayn 3 1,058 Dec-30-2022, 10:18 AM
Last Post: ibreeden
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,064 Dec-15-2022, 04:32 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020