From d1127ca114a8ba419b9b5b5cba6fac804b658fd9 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Thu, 28 Dec 2023 20:06:58 -0700 Subject: [PATCH] docstrings, encoding get_pkg_reqs --- scripts/get_package_requirements.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/get_package_requirements.py b/scripts/get_package_requirements.py index 0d57c028..43324452 100644 --- a/scripts/get_package_requirements.py +++ b/scripts/get_package_requirements.py @@ -1,9 +1,17 @@ +""" +This script extracts the package names and versions from a requirements.txt file and writes them to a new file. +The new file can be used to install the same package versions on another machine. +""" + import pkg_resources def get_package_versions(requirements_path, output_path): + """ + Extract package names and versions from a requirements.txt file and write them to a new file. + """ try: - with open(requirements_path, "r") as file: + with open(requirements_path, "r", encoding="utf-8") as file: requirements = file.readlines() except FileNotFoundError: print(f"Error: The file '{requirements_path}' was not found.")