HaRo87 / mdbom

Software Bill of Material (SBOM) to Markdown conversion
MIT License
9 stars 3 forks source link

Failure to run `generate` on macOS/homebrew. #33

Open preston opened 2 years ago

preston commented 2 years ago

It seems that the script can't find a template.md.jinja file, causing a runtime error. This is on a macOS machine with Python installed via homebrew.

$ python3 --version
Python 3.10.6
$ pip3 install mdbom 
[...]
$ mdb generate --input doc/bom/bom.json --output doc/bom/mdb.md --type npm
Traceback (most recent call last):
  File "/opt/homebrew/bin/mdb", line 8, in <module>
    sys.exit(cli())
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/homebrew/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/mdbom/mdbom.py", line 85, in generate
    generate_markdown(
  File "/opt/homebrew/lib/python3.10/site-packages/mdbom/md/md.py", line 27, in generate_markdown
    with open(template, "r") as template_file:
FileNotFoundError: [Errno 2] No such file or directory: 'template.md.jinja'
HaRo87 commented 1 year ago

Hi @preston, sorry, I missed this one. As stated in the docs you need either define a template via --template or the default is used which expects a file called template.md.jinja to be present in the current directory. You can find an example template file in the here.