New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to Access collections.OrderedDict
Variables in cookiecutter.json
despite proper Key Definition
#2005
Comments
Cookiecutter checks the values of cookiecutter.json, to see if any are Jinja2 templates or strings. From experimenting, it seems cookiecutter does not recurse through arbitrary many levels of nested dictionaries, looking for all possible values in the tree that are Jinja2 templates (e.g. strings). There's no error for me with a flat JSON mapping: Test file and directory structure
cookiecutter.json
|
It looks like you can reference a dictionary variable inside another dictionary variable, but you can't reference it when resolving a root-level level variable. So this works:
but this does not:
|
Ok, I see what's happening:
Presumably this is a consequence of the fact that it's sort of nice to have the JSON inputs last when you are prompting the user to supply values, since they are structured differently. But it leads to this unintuitive behaviour when you are using I think there's no quick fix, it would require reworking the behaviour of the whole prompting function. |
Nice work Jun-Dai. :) |
Description:
I'm attempting to retrieve
collections.OrderedDict
variables fromcookiecutter.json
. However, despite having the key specified at the beginning, the attribute cannot be located. Please refer to the provided example ofcookiecutter.json
for clarification:The error I get running the template is the following:
The text was updated successfully, but these errors were encountered: