You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a custom config file is present but empty, sdsstools hangs when loading. My guess is it's entered into a form of recursive reading loop. I'd expect an empty config file to resolve to a blank dictionary object during merge with its parent in package/etc/xxx.yml
To reproduce:
create an empty custom config, e.g. ~/.config/sdss/tree.yml
try to load the config file with sdsstools.get_config("tree")
Traceback upon key interrupt
from sdsstools import get_config, get_logger, get_package_version
config=get_config('tree')
^C---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-2-e5a3198d9f43> in <module>
----> 1 config=get_config('tree')
~/anaconda3/envs/treetest/lib/python3.7/site-packages/sdsstools/configuration.py in get_config(name, config_file, allow_user, user_path, config_envvar, merge_mode, default_envvars)
174 if merge_mode == 'update':
175 return Configuration(custom_config_fn, base_config=config_file,
--> 176 default_envvars=default_envvars)
177 else:
178 return Configuration(custom_config_fn, base_config=None,
~/anaconda3/envs/treetest/lib/python3.7/site-packages/sdsstools/configuration.py in __init__(self, config, base_config, default_envvars)
211 __ENVVARS__ = default_envvars
212
--> 213 self.load(config)
214
215 def _parse_config(self, config, use_base=True):
~/anaconda3/envs/treetest/lib/python3.7/site-packages/sdsstools/configuration.py in load(self, config)
244 self.CONFIG_FILE = None
245
--> 246 super().__init__(self._parse_config(config))
247
248 # Save name of the configuration file (if the input is a file).
~/anaconda3/envs/treetest/lib/python3.7/site-packages/sdsstools/configuration.py in _parse_config(self, config, use_base)
225 raise ValueError('Invalid config of type {}'.format(type(config)))
226
--> 227 return merge_config(self._parse_config(config, use_base=False), self._BASE)
228
229 def load(self, config=None):
~/anaconda3/envs/treetest/lib/python3.7/site-packages/sdsstools/configuration.py in _parse_config(self, config, use_base)
221 return config
222 elif isinstance(config, (str, pathlib.Path)):
--> 223 return read_yaml_file(config)
224 else:
225 raise ValueError('Invalid config of type {}'.format(type(config)))
~/anaconda3/envs/treetest/lib/python3.7/site-packages/sdsstools/configuration.py in read_yaml_file(path, use_extends, loader)
58 fp.seek(0)
59 while True:
---> 60 line = fp.readline()
61 if line.strip().startswith('#!extends'):
62 base_file = line.strip().split()[1]
~/anaconda3/envs/treetest/lib/python3.7/codecs.py in decode(self, input, final)
317 raise NotImplementedError
318
--> 319 def decode(self, input, final=False):
320 # decode input (taking the buffer into account)
321 data = self.buffer + input
KeyboardInterrupt:
The text was updated successfully, but these errors were encountered:
Mmm, interesting. It seems this fails because of some come I added to allow extending a YAML from a different YAML. It should be fairly easy to fix and test.
When a custom config file is present but empty,
sdsstools
hangs when loading. My guess is it's entered into a form of recursive reading loop. I'd expect an empty config file to resolve to a blank dictionary object during merge with its parent inpackage/etc/xxx.yml
To reproduce:
~/.config/sdss/tree.yml
sdsstools.get_config("tree")
Traceback upon key interrupt
The text was updated successfully, but these errors were encountered: