From 58aa617c8650fafe7ca28205e6b9be3e72599baa Mon Sep 17 00:00:00 2001 From: Fergal Armstrong <148789+fffergal@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:05:04 +0100 Subject: [PATCH] Fix startup when no write permissions Making the parent directories of the config file could cause an exception if the process doesn't have write permissions. This is common with remote debugging in containers. Catch exceptions, log, and continue, same as other parts of the settings that cannot raise exceptions. The next stage of saving the config file will also fail, but this is already caught. --- pudb/settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pudb/settings.py b/pudb/settings.py index a0be468a..c4f4e153 100644 --- a/pudb/settings.py +++ b/pudb/settings.py @@ -49,7 +49,10 @@ def get_save_config_path(): return None path = os.path.join(XDG_CONFIG_HOME, XDG_CONF_RESOURCE) - os.makedirs(path, mode=0o700, exist_ok=True) + try: + os.makedirs(path, mode=0o700, exist_ok=True) + except Exception: + settings_log.exception("Failed to make config dir") return path