pytroll/pyspectral

Update yaml usage to work with pyyaml 5.1+

djhoese opened this issue · 0 comments

Importing pyspectral's config.py module results in:

/Users/davidh/repos/git/pyspectral/pyspectral/config.py:75: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = recursive_dict_update(config, yaml.load(fp_))

This is because of a deprecation in pyyaml 5.1+ (see here).

This should be updated to use:

try:
    from yaml import UnsafeLoader
except ImportError:
    from yaml import Loader as UnsafeLoader

res = yaml.load(file, Loader=UnsafeLoader)