I thought I had fixed my problem. In fact I marked post solved. The following code works as long as user selects Race 1. But select any other race number and it won't print out. Throws the following error.
TICKET TO RICHES
FLASHY PATCH
HAUTE PROSPECT
MISS VICKI
HONEST GINGER
ABOGADA
But if any other race number selected it throws this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "testloop.py", line 134, in select_track
load_track_to_Handi()
File "testloop.py", line 95, in load_track_to_Handi
if int(xx[hcount][0])== int(race_number):
ValueError: invalid literal for int() with base 10: 'AP '
I don't understand this at all. I thought the [1] in the code stood for column 1.
def load_track_to_Handi(): my_tracklabel= Label(root, text =" ", fg= "#F50808", font = ("sans_serif" , 16)).place(x=380, y=430) read_csvfile_into_array() global track_abrev global race_number global xx #if fileFound ==True: hcount = 0 with open( 'C://guis/f_racefiles/'+ track_abrev + '.csv' , 'r') as race_file: df = pd.read_csv(race_file, header =None) xx = df.iloc[ :,0:19 ].values for i in range(0,len(xx)): if int(xx[hcount][1])== int(race_number): print(xx[hcount][18]) hcount+=1Select race 1 and this is the print out:
TICKET TO RICHES
FLASHY PATCH
HAUTE PROSPECT
MISS VICKI
HONEST GINGER
ABOGADA
But if any other race number selected it throws this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Milford\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
return self.func(*args)
File "testloop.py", line 134, in select_track
load_track_to_Handi()
File "testloop.py", line 95, in load_track_to_Handi
if int(xx[hcount][0])== int(race_number):
ValueError: invalid literal for int() with base 10: 'AP '
I don't understand this at all. I thought the [1] in the code stood for column 1.