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

Empty mkdocs_theme.yml file in custom theme leads to exception on `mkdocs serve` #1602

Closed
chrissimpkins opened this Issue Aug 22, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@chrissimpkins

chrissimpkins commented Aug 22, 2018

Reported by @Martian101 on the Cinder theme repository here chrissimpkins/cinder#46.

Our custom theme was released with an empty mkdocs_theme.yml file in the root of the theme directory. The user experienced the following AttributeError when the mkdocs serve command was executed:

Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/__main__.py", line 134, in serve_command
    livereload=livereload
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/commands/serve.py", line 119, in serve
    config = builder()
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/commands/serve.py", line 107, in builder
    site_dir=site_dir
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/config/base.py", line 197, in load_config
    errors, warnings = cfg.validate()
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/config/base.py", line 115, in validate
    post_failed, post_warnings = self._post_validate()
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/config/base.py", line 95, in _post_validate
    config_option.post_validation(self, key_name=key)
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/config/config_options.py", line 432, in post_validation
    config[key_name] = theme.Theme(**theme_config)
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/theme.py", line 47, in __init__
    self._load_theme_config(name)
  File "/usr/local/lib/python3.5/dist-packages/mkdocs/theme.py", line 96, in _load_theme_config
    parent_theme = theme_config.pop('extends', None)
AttributeError: 'NoneType' object has no attribute 'pop'

According to your documentation, an empty settings file appears to be acceptable and supported (https://www.mkdocs.org/user-guide/custom-themes/#theme-configuration) so I am reporting as a possible bug or need for documentation update here.

@waylan

This comment has been minimized.

Member

waylan commented Aug 22, 2018

Fixed in #1603

@waylan waylan closed this Aug 22, 2018

@chrissimpkins

This comment has been minimized.

chrissimpkins commented Aug 22, 2018

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment