From 3e2a6011ff74259997b56d095edac3e3a7135aa7 Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 16 Dec 2020 05:45:05 +0100 Subject: [PATCH] [core] Ignore comments in configuration environment variables Comments are treated as keys with no value by configparser, but env variables with None as the value are not valid so this would crash. Fixes #156 --- legendary/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legendary/core.py b/legendary/core.py index c813705..4a5cc90 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -375,9 +375,9 @@ class LegendaryCore: # get environment overrides from config env = os.environ.copy() if 'default.env' in self.lgd.config: - env.update(dict(self.lgd.config['default.env'])) + env.update({k: v for k, v in self.lgd.config[f'default.env'].items() if v and not k.startswith(';')}) if f'{app_name}.env' in self.lgd.config: - env.update(dict(self.lgd.config[f'{app_name}.env'])) + env.update({k: v for k, v in self.lgd.config[f'{app_name}.env'].items() if v and not k.startswith(';')}) if wine_pfx: env['WINEPREFIX'] = wine_pfx