Skip to content
Snippets Groups Projects
Commit e2a9238a authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Be more helpful when config.toml cannot be written

parent d6982cdf
No related branches found
No related tags found
No related merge requests found
......@@ -85,9 +85,14 @@ def initialize_config(application_name: str, default_config: str) -> dict:
# Create a default config if it does exist
if not Path.is_file(Path(config_path)):
try:
write_config(config_path, default_strconfig)
print("Created new default config.toml at:\n{}".format(config_path))
config = read_config(config_path)
except PermissionError as e:
print("Error: Not sufficient permissions to write default config.toml into directory {} (as user {})".format(config_dir, getpass.getuser()), file=sys.stderr)
print("Consider changing permissions on {} manually so writing is allowed for user {}. After initial write of default config.toml on the first run {} won't write that file ever again. so you can make it read only for {} after that".format(config_dir, getpass.getuser(), application_name, getpass.getuser()), file=sys.stderr)
exit(1)
else:
config = read_config(config_path)
if config_has_missing_keys(config, default_config, default_strconfig):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment