cookiecutter / cookiecutter/cookiecutter
Empty property in json Raise error because index out of range
- Dominant language
- Python
- Stars
- 25.1k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
* Cookiecutter version:2.6.0
* Template project url: local version
* Python version: 3.12
* Operating System: windows 11
### Description:
so i am working on a program for the user to set some variable and depending on the choices a coresponding folder is generated sometimes he can leave things empty or so and its all up to him
the problem that when cookiecutter checked the generated json file and found an empty list in one of the properties it exits which isnt normal because the value isnt used inside the project and when i checked i found that prompt.py line 258 is the reason because it return the first element when there is no element in the first place when the user doesnt insert manually
### What I've run:
i just ran the normal cookicutter command with the -o and the -f and --no-input
Contributor guide
Research direction
Start in prompt.py around line 258 and reproduce the reported command with -o, -f, and --no-input using a template containing an empty JSON list property. Trace how the empty value is handled during rendering and verify that an unused empty property no longer causes an index-out-of-range error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100