Taking inputs through input command and calling object from main file.
rafTur = input(' : ')
rafKat = input(' : ')
rafNo = input( : ')
rafIndex = input(' : ')
req.search_record(' : ')
req.search_record(rafTur, rafKat, rafNo, rafIndex)
req.py :
def search_record( rafTur, rafKat, rafNo, rafIndex= None):
infile = open('noSqlDB', 'rb')
flag = False
while True:
try:
reading the oject from file
sistem = pickle.load(infile)
if sistem['rafTur'] == rafTur and sistem['rafKat'] == rafKat and sistem['rafNo'] == rafNo and rafIndex==None: # This is where the error happens
print("Raf No : ",sistem['rafIndex'],"Raf data : ",sistem['rafIndexData'])
print(":", rafIndex)
flag = True
break
# display record if found and set flag
if (sistem['rafTur'] == rafTur and sistem['rafKat'] == rafKat and sistem['rafNo'] == rafNo and sistem['rafIndex'] == rafIndex):
print(sistem['rafIndexData'],"\n")
flag = True
break
except EOFError:
print("deb")
break
if flag == False:
print('Record not Found')
print()
infile.close()
I'm trying to overload search_record() function. When I put = None to rafIndex variable the program exits with OFError and prints deb ( just for debugging ). The code works fine without = None command also second if works without = None command.
I tried changing if statement with == None to == '' it also doesn't work. I also tried assigning rafIndex to None manually by rafIndex = None but it also doesn't work.

Using python 3.9 virtualenv in Clion