os.path.join (folder, filename) ensures the path is correct for the system. On Windows, it uses backslashes (reports\summary.txt); on Linux and macOS it uses forward slashes (reports/summary.txt).
One of Python’s most persistent limitations is how unnecessarily difficult it is to take a Python program and give it to another user as a self-contained click-to-run package. The design of the Python ...