From 7fc79cd384cc87b49193b76f99e4f57632eb0459 Mon Sep 17 00:00:00 2001 From: kRHYME7 Date: Tue, 19 Nov 2024 10:46:33 +0800 Subject: [PATCH] I'm dumb! --- generate_readme.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/generate_readme.py b/generate_readme.py index 89ac2e4..0ddf292 100755 --- a/generate_readme.py +++ b/generate_readme.py @@ -79,8 +79,15 @@ def hex_to_intensity(hex_color): + MD_TABLE ) -# Write the updated content back to README.md -with open("README.md", "w", encoding="utf-8") as readme_file: - readme_file.write(updated_readme_content) +import os + +# Check if the script has write permissions for README.md +if os.access("README.md", os.W_OK): + # Write the updated content back to README.md + with open("README.md", "w", encoding="utf-8") as readme_file: + readme_file.write(updated_readme_content) + print("README.md has been updated with the generated Markdown table.") +else: + print("Permission denied: 'README.md'. Please check the file permissions.") print("README.md has been updated with the generated Markdown table.")