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

mkdocs build fails when the tags plugin is present but the tags_file attribute is missing #4105

Closed
5 tasks done
ben519 opened this issue Jul 10, 2022 · 2 comments
Closed
5 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@ben519
Copy link
Sponsor

ben519 commented Jul 10, 2022

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

According to the docs, I should be able to include the tags plugin without also including a tags_file. This worked until recently when I encountered an error running mkdocs build.

Expected behaviour

mkdocs build should render the site even if tags_file is excluded.

Actual behaviour

mkdocs.yml

...

plugins:
  - tags

error

(venv) bgorman@Bens-MacBook-Pro practice-probs % python3 -m mkdocs build
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/site
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/mkdocs/__main__.py", line 236, in <module>
    cli()
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/mkdocs/__main__.py", line 192, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/mkdocs/commands/build.py", line 287, in build
    nav = config['plugins'].run_event('nav', nav, config=config, files=files)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/mkdocs/plugins.py", line 102, in run_event
    result = method(item, **kwargs)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/material/plugins/tags/plugin.py", line 70, in on_nav
    self.tags_file = self._get_tags_file(files, file)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/material/plugins/tags/plugin.py", line 108, in _get_tags_file
    file = files.get_file_from_path(path)
  File "/Users/bgorman/Dropbox (GormAnalysis)/Practice Probs/practice-probs/venv/lib/python3.9/site-packages/mkdocs/structure/files.py", line 32, in get_file_from_path
    return self.src_paths.get(os.path.normpath(path))
  File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py", line 336, in normpath
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Steps to reproduce

  1. Stand up a Hello World project
  2. Insert the tags plugin inside mkdocs.yml
plugins:
  - tags
  1. Attempt to build the site
python3 -m mkdocs build

Package versions

  • Python: python --version: Python 3.9.13 (also tested on 3.10)
  • MkDocs: mkdocs --version: 1.3.0
  • Material: pip show mkdocs-material | grep -E ^Version: Version: 8.3.9+insiders.4.20.0

Configuration

site_name: Hello World

theme:
  name: material
 
plugins:
  - tags

nav:
  - Home: index.md

System information

  • Operating system: Mac OS 12.4
  • Browser: Chrome Version 103.0.5060.114 (Official Build) (x86_64)
@squidfunk
Copy link
Owner

Thanks for reporting. That was a 4.20.0 regression, sorry for the inconvenience.

Fixed in squidfunk/mkdocs-material-insiders@9083945

@squidfunk
Copy link
Owner

Released as part of 8.3.9+insiders-4.20.1.

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open labels Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants