This file, specifically the line os.path.join(os.getcwd(), file), is throwing FileNotFoundError: [Errno 2] No such file or directory. The same seems to be working fine in RHEL 9 though. Seems it is because of the difference in the way these 2 OS handle file paths, relative vs absolute. Changing the same line to os.path.abspath(file) fixes the issue.