line 114 if fname.exists(): is error, because variable "fname" is str type, no exists attribution. change to if os.path.exists(fname):