Skip to content

Interpolation error with DEEP or DEEP_NO_BACKTRACK #47

Open

Description

@chinghwayu

conf.py

var1 = "2020"
var2 = "{var1}"
var3 = "{var1}/{var2}"

mytest.py

module_list = ["conf.py"]
cfg = config(*module_list, separator="__", interpolate=True, interpolate_type=InterpolateEnumType.DEEP_NO_BACKTRACK)
print(cfg["var3"])

Sometimes it will work and return

2020/2020

But other times, it will return

  File "/home/chinghwa/.pyenv/versions/py365-dev/lib/python3.6/site-packages/config/configuration_set.py", line 110, in __getitem__
    return self._from_configs("__getitem__", item)
  File "/home/chinghwa/.pyenv/versions/py365-dev/lib/python3.6/site-packages/config/configuration_set.py", line 83, in _from_configs
    return interpolate_object(args[0], values[0], d, self._interpolate_type)
  File "/home/chinghwa/.pyenv/versions/py365-dev/lib/python3.6/site-packages/config/helpers.py", line 197, in interpolate_object
    return interpolate_deep(attr, obj, d, {}, {}, method)
  File "/home/chinghwa/.pyenv/versions/py365-dev/lib/python3.6/site-packages/config/helpers.py", line 147, in interpolate_deep
    raise KeyError(variable)
KeyError: 'var1'

Activity

  1. tr11 commented on Sep 30, 2020

    @tr11
    Owner

    I'll take a look at it this weekend. I'm planning on unifying the way the templating works that will hopefully fix all these issues

  2. chinghwayu commented on Nov 11, 2020

    @chinghwayu
    ContributorAuthor

    I'll take a look at it this weekend. I'm planning on unifying the way the templating works that will hopefully fix all these issues

    Any chance at looking at this again in the near future? 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions