Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

j2cli brokes drastically when data has no/invalid filename extensions #55

Open
brlin-tw opened this issue Apr 15, 2020 · 0 comments
Open

Comments

@brlin-tw
Copy link

Reproduce

$ j2 template.j2 data
Traceback (most recent call last):
  File "/home/brlin/.local/bin/j2", line 8, in <module>
    sys.exit(main())
  File "/home/brlin/.local/pipx/venvs/j2cli/lib/python3.6/site-packages/j2cli/cli.py", line 206, in main
    sys.argv[1:]
  File "/home/brlin/.local/pipx/venvs/j2cli/lib/python3.6/site-packages/j2cli/cli.py", line 138, in render_command
    }[os.path.splitext(args.data)[1]]
KeyError: ''

Expected behavior

  • j2cli detect data type automatically
  • j2cli fails with a friendly message regard the issue (e.g., Error: _data_ must have the following filename extensions: ...)

Version

j2cli 0.3.10, Jinja2 2.11.1
installed via pipx

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

No branches or pull requests

1 participant