noahmorrison / chevron

A Python implementation of mustache
MIT License
480 stars 52 forks source link

chevron crash with minimal parameters #126

Open Pyrrha opened 6 months ago

Pyrrha commented 6 months ago

Hello,

I just installed the executable from pip and tried to run it.

The chevron command works fine:

$ chevron
usage: chevron [-h] [-v] [-d DATA] [-p PARTIALS_PATH] [-e PARTIALS_EXT] [-l DEF_LDEL] [-r DEF_RDEL] [-w] template
chevron: error: the following arguments are required: template

But adding only the mandatory argument make it crash:

$ chevron template.mustache
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/chevron", line 8, in <module>
    sys.exit(cli_main())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chevron/main.py", line 100, in cli_main
    sys.stdout.write(main(**args))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chevron/main.py", line 19, in main
    with io.open(data, 'r', encoding='utf-8') as data_file:
TypeError: expected str, bytes or os.PathLike object, not dict

I'm expecting the command result to not crash, and render the template without any data instead of tokens, according to current behaviour when tokens keys are missing in json file.

What do you think?

FaridFArab commented 1 month ago

Hi @Pyrrha, Would you tell me which Python version do you use ?