mikitex70 / plantuml-markdown

PlantUML plugin for Python-Markdown
BSD 2-Clause "Simplified" License
198 stars 55 forks source link

3.10.0: expected str, bytes or os.PathLike object, not list #101

Closed jhonnen closed 4 months ago

jhonnen commented 4 months ago

Our mkdocs build fails with the following error after updating to 3.10.0, the previous version works fine:

> mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: <dir>/site
ERROR   -  Error reading page '<file with a plantuml diagram>': expected str, bytes or os.PathLike object, not list
Traceback (most recent call last):
  File "/home/user/.local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/mkdocs/__main__.py", line 284, in build_command
    build.build(cfg, dirty=not clean)
  File "/home/user/.local/lib/python3.10/site-packages/mkdocs/commands/build.py", line 310, in build
    _populate_page(file.page, config, files, dirty)
  File "/home/user/.local/lib/python3.10/site-packages/mkdocs/commands/build.py", line 167, in _populate_page
    page.render(config, files)
  File "/home/user/.local/lib/python3.10/site-packages/mkdocs/structure/pages.py", line 285, in render
    self.content = md.convert(self.markdown)
  File "/home/user/.local/lib/python3.10/site-packages/markdown/core.py", line 354, in convert
    self.lines = prep.run(self.lines)
  File "/home/user/.local/lib/python3.10/site-packages/plantuml_markdown/plantuml_markdown.py", line 158, in run
    text1, idx1 = self._replace_block(text[idx:])
  File "/home/user/.local/lib/python3.10/site-packages/plantuml_markdown/plantuml_markdown.py", line 231, in _replace_block
    diagram, err = self._render_diagram(code, requested_format)
  File "/home/user/.local/lib/python3.10/site-packages/plantuml_markdown/plantuml_markdown.py", line 376, in _render_diagram
    diagram, err = self._render_local_uml_image(code, requested_format)
  File "/home/user/.local/lib/python3.10/site-packages/plantuml_markdown/plantuml_markdown.py", line 450, in _render_local_uml_image
    full_path = os.path.join(self._base_dir, self._config_path) if self._base_dir else self._config_path
  File "/usr/lib/python3.10/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not list

self._base_dir contains ['.']

mikitex70 commented 4 months ago

Hi @jhonnen, I've fixed the issue and released version 3.10.1. I missed a self._base_dir, sorry for the inconvenience.

jhonnen commented 3 months ago

thanks for the quick fix!