summaryrefslogtreecommitdiff
path: root/pywal/util.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-07-23 22:00:46 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-07-23 22:00:46 +1000
commit2e39be9627571af3844c5a2d5f2f826d9e80fcea (patch)
treec3b00a684e0fe4aa47d8b6dbf8af764838668329 /pywal/util.py
parent3f10cc888d0baf2288f5b6d8f1d3cc8e80ec2dea (diff)
general: Save file error handling
Diffstat (limited to 'pywal/util.py')
-rw-r--r--pywal/util.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pywal/util.py b/pywal/util.py
index 25a36a4..06c0510 100644
--- a/pywal/util.py
+++ b/pywal/util.py
@@ -77,8 +77,11 @@ def save_file(data, export_file):
"""Write data to a file."""
create_dir(os.path.dirname(export_file))
- with open(export_file, "w") as file:
- file.write(data)
+ try:
+ with open(export_file, "w") as file:
+ file.write(data)
+ except PermissionError:
+ print(f"[!] warning: Couldn't write to {export_file}.")
def save_file_json(data, export_file):