This appears to primarily be an issue with find_product_file where it assumes that all files returned by os.scandir exist. But os.scandir will list broken symbolic links.
os.scandir returns directory entries, it looks like is_file can be used to determine if a symbolic link is broken.
The desired behavior is to raise a KeyError if the product file is a broken symbolic link, just as if no existing file is found.
This appears to primarily be an issue with
find_product_filewhere it assumes that all files returned byos.scandirexist. Butos.scandirwill list broken symbolic links.os.scandirreturns directory entries, it looks likeis_filecan be used to determine if a symbolic link is broken.The desired behavior is to raise a
KeyErrorif the product file is a broken symbolic link, just as if no existing file is found.