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.")