whenever keyerror is occuring it means that if you are using a dictionary in your code the dictionary is not given correct key.
For eg.
new_dict = {'A':1,'B':3,'D':4}
print(new_dict['C'])
the last line above will give keyerror as there is no key āCā in the new_dict
dictionary.
In your code you are using the dictionary dict_auto_file into which you are providing some key for which you want some value. Most probably that is giving error.
Just try to print dict_auto_file
and also print the inside key that you are providing to it separately and check if the key exists in dict_auto_file. You can print these just above the a
variable that you have created.