alexferl / vyper

Python configuration with (more) fangs
MIT License
144 stars 21 forks source link

merge_in_config fail #14

Closed jolee11 closed 5 years ago

jolee11 commented 6 years ago

Hello, I cannot merge content from two config files. Please give me some help! Thank you very much!


I have two yaml config files:

  1. x.yaml a: "abc"

  2. y.yaml a: "xyz"


The test.py is:

from vyper import v

v.add_config_path('.') v.set_config_type('yaml') v.set_config_name("x") v.read_in_config() print(v.get_string("a")) # expect 'abc'

v.set_config_name("y") v.merge_in_config() print(v.get_string("a")) # expect 'xyz'

''' Actual output:

abc Traceback (most recent call last): File "/Users/createtech/temp/pyvyper/vyper/util.py", line 56, in unmarshall_config_reader d.update(yaml.load(f)) ValueError: dictionary update sequence element #0 has length 1; 2 is required

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "test.py", line 11, in v.merge_in_config() File "/Users/createtech/temp/pyvyper/vyper/vyper.py", line 535, in merge_in_config return self.mergeconfig(file) File "/Users/createtech/temp/pyvyper/vyper/vyper.py", line 548, in merge_config cfg = self._unmarshallreader(file, cfg) File "/Users/createtech/temp/pyvyper/vyper/vyper.py", line 568, in _unmarshall_reader return util.unmarshall_configreader(file, d, self._get_config_type()) File "/Users/createtech/temp/pyvyper/vyper/util.py", line 60, in unmarshall_config_reader raise ConfigParserError(e) vyper.util.ConfigParserError: While parsing config: dictionary update sequence element #0 has length 1; 2 is required '''

alexferl commented 5 years ago

Hi,

Sorry that issue slipped past me, I can confirm I have the same behaviour. I'll check it.

jolee11 commented 5 years ago

Thank you very much!

alexferl commented 5 years ago

This is fixed in v0.3.3.