Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

md_header_level should be read as an int in toml files #90

Open
agateau-gg opened this issue Mar 29, 2023 · 0 comments
Open

md_header_level should be read as an int in toml files #90

agateau-gg opened this issue Mar 29, 2023 · 0 comments

Comments

@agateau-gg
Copy link

agateau-gg commented Mar 29, 2023

Given this pyproject.toml file:

[tool.scriv]
format = "md"
md_header_level = 2

scriv create fails with that error message:

Traceback (most recent call last):
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/bin/scriv", line 8, in <module>
    sys.exit(cli())
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/scriv/create.py", line 35, in create
    scriv = Scriv()
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/scriv/scriv.py", line 26, in __init__
    self.config = Config.read()
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/scriv/config.py", line 290, in read
    attr.validate(config._options)
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/attr/_make.py", line 1964, in validate
    v(inst, a, getattr(inst, a.name))
  File "/home/agateau/.local/share/virtualenvs/ddeb52ca26ac4f6/lib/python3.10/site-packages/attr/validators.py", line 149, in __call__
    if not self.match_func(value):
TypeError: expected string or bytes-like object

Right now the work-around is to declare md_header_level as a string, like this:

[tool.scriv]
format = "md"
md_header_level = "2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant