ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
277 stars 31 forks source link

ac_query not working on v0.9.9 #108

Closed jamesmyatt closed 5 years ago

jamesmyatt commented 5 years ago

I have anyconfig v0.9.9 installed via conda-forge and the example of using ac_query from the README.md is not working. I get the following:

>>> dic = dict(a=dict(b=[dict(c="C", d=0)]))
>>> anyconfig.loads(anyconfig.dumps(dic, ac_parser="json"), ac_parser="json", ac_query="a.b[0].c")
{'a': {'b': [{'c': 'C', 'd': 0}]}}
jamesmyatt commented 5 years ago

Ah. The problem is that jmespath was not installed. I think it would be better for ac_query to raise a ValueError (or similar) if jmespath is not installed?

ssato commented 5 years ago

Sorry to late and thanks a lot for your suggestion! I'll look the code closely to consider that change this week.

ssato commented 5 years ago

I think that b902fe5 may resolve this.