Skip to content

Docs: Sphinx build fails with FileNotFoundError in generate_cookiecutter_cli.py due to missing output directory #157

Description

@ojeda-e

Description

Building Sphinx docs fails because docs/scripts/generate_cookiecutter_cli.py calls shutil.copytree() with a directory that does not exist. The failure happens when conf.py runs generate_cookiecutter_cli() on import.

from generate_cookiecutter_cli import main as generate_cookiecutter_cli # noqa: E402

Behaviour

The script assumes that the generated project folder is always named example-repository.

self.repo_name = "example-repository"

In reality, Jinja generates <repo_name> in cookiecutter.json from project_name.

For example, the project name mia_test generates a folder mia_test - not example-repository, and this mismatch is what shutil.copytree() doesn't like.

source_repo = os.path.join(tmpdir, self.repo_name)
destination_repo = str(self.example_repo_path.resolve())
shutil.rmtree(destination_repo, ignore_errors=True)
shutil.copytree(source_repo, destination_repo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions