mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-15 14:16:58 +02:00
general: Save file error handling
This commit is contained in:
parent
3f10cc888d
commit
2e39be9627
@ -77,8 +77,11 @@ def save_file(data, export_file):
|
|||||||
"""Write data to a file."""
|
"""Write data to a file."""
|
||||||
create_dir(os.path.dirname(export_file))
|
create_dir(os.path.dirname(export_file))
|
||||||
|
|
||||||
with open(export_file, "w") as file:
|
try:
|
||||||
file.write(data)
|
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):
|
def save_file_json(data, export_file):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user