Skip to content
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

Modifying start and end variable string jinja env variables inside of the user config default context does not work #2034

Open
codytodonnell opened this issue Mar 14, 2024 · 0 comments

Comments

@codytodonnell
Copy link

Description:

I am trying to use alternate variable_start_string and variable_end_string values. I am trying to specify these values from the user config yaml instead of the cookiecutter.json.

What I've run:

The name of my template is base (linked above) and I want it to use {@ @} instead of {{ }} for the template strings.

This is what I am running:

cookiecutter --config-file cookiecutter.yaml base

And my cookiecutter.yaml looks like this:

default_context:
  _jinja2_env_vars:
    variable_start_string: "{@"
    variable_end_string: "@}"

But when I run the command I get the following error:

Traceback (most recent call last):
  File "path/bin/cookiecutter", line 8, in <module>
    sys.exit(main())
  File "path/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "path/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "path/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "path/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "path/lib/python3.9/site-packages/cookiecutter/cli.py", line 203, in main
    cookiecutter(
  File "path/lib/python3.9/site-packages/cookiecutter/main.py", line 182, in cookiecutter
    result = generate_files(
  File "path/lib/python3.9/site-packages/cookiecutter/generate.py", line 315, in generate_files
    template_dir = find_template(repo_dir, env)
  File "path/lib/python3.9/site-packages/cookiecutter/find.py", line 31, in find_template
    raise NonTemplatedInputDirException
cookiecutter.exceptions.NonTemplatedInputDirException

If I add the _jinja2_env_vars to cookiecutter.json, everything works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant