Skip to content

Bug: Template fails with "name 'unicode' is not defined" on macOS #50

@josephwilson8-nhs

Description

@josephwilson8-nhs

Problem

Running the cookiecutter on macOS fails immediately after the final prompt with:

Error: name 'unicode' is not defined

Current Behavior

After answering all prompts, template generation aborts before any files are created. The error originates from the {% now %} Jinja2 tag used in cookiecutter.json and several template files (mkdocs.yml, model_card_template.md, CONTRIBUTING.md).

The {% now %} tag is provided by the jinja2-time extension. This was a transitive dependency of cookiecutter up to version 2.2.x but was removed in 2.3.0+. On a fresh macOS install with a current version of cookiecutter, jinja2-time is not present. When it is missing, the internal arrow package (which jinja2-time depends on) falls back to Python 2 compatibility code that references unicode as a builtin — which does not exist in Python 3.

Expected Behavior

Template generation completes successfully on macOS without requiring jinja2-time to be installed.

Metadata

Metadata

Labels

bugSomething isn't workingcookiecutterChanges to the cookiecutter repository itselftemplateChanges to the generated template/project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions