Used KeyError exception instead of checking whether the file exists or not