From 80a85797cd7e617c54d37de5afc693e19a659bb4 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Wed, 30 Nov 2022 13:46:38 +0100 Subject: [PATCH] fix: _write_definitions Permission denied --- pv_visualizer/app/engine/proxymanager/core.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pv_visualizer/app/engine/proxymanager/core.py b/pv_visualizer/app/engine/proxymanager/core.py index f9346b9..048c8f4 100644 --- a/pv_visualizer/app/engine/proxymanager/core.py +++ b/pv_visualizer/app/engine/proxymanager/core.py @@ -359,9 +359,13 @@ def _write_definition(self, proxy_type, extension, content): Path(self._write_definitions_base) / f"{'/'.join(proxy_type.split('__'))}.{extension}" ) - os.makedirs(file_name.parent, exist_ok=True) - with open(file_name, "w") as file: - file.write(content) + + try: + os.makedirs(file_name.parent, exist_ok=True) + with open(file_name, "w") as file: + file.write(content) + except PermissionError: # Write-protection + pass def _proxy_ensure_definition(self, proxy): proxy_type = definitions.proxy_type(proxy)