I tried to print out the variable gayle and it assigns values correctly. I can't find why is my program stopping if i input non-existent ID.
os.system("clear")
print('\tSEARCH AND VIEW FILE\n')
gayle=0
file_input = input('Search ID Number: ')
proj = io.open('all_projects.csv', 'r')
while True:
data = proj.readline()
if file_input in data:
txt = data
gayle += 1
break
proj.close()
if gayle > 0:
list2 = txt.split(",")
i = Preview(list2)
i.view()
print(gayle)
try_again('Search file again?','Invalid input.',2)
elif (gayle == 0):
print("Not exist")