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

Error on mkdocs build command #77

Closed
thebigmunch opened this issue Apr 8, 2020 · 1 comment
Closed

Error on mkdocs build command #77

thebigmunch opened this issue Apr 8, 2020 · 1 comment

Comments

@thebigmunch
Copy link

Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
  File "c:\python38\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\python38\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\python38\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python38\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python38\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\python38\lib\site-packages\mkdocs\__main__.py", line 159, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "c:\python38\lib\site-packages\mkdocs\commands\build.py", line 274, in build
    _populate_page(file.page, config, files, dirty)
  File "c:\python38\lib\site-packages\mkdocs\commands\build.py", line 177, in _populate_page
    page.content = config['plugins'].run_event(
  File "c:\python38\lib\site-packages\mkdocs\plugins.py", line 94, in run_event
    result = method(item, **kwargs)
  File "c:\python38\lib\site-packages\mkdocstrings\plugin.py", line 160, in on_page_content
    self.map_urls(page.canonical_url, item)
  File "c:\python38\lib\site-packages\mkdocstrings\plugin.py", line 173, in map_urls
    self.url_map[anchor.id] = base_url + anchor.url
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

The error doesn't happen with mkdocs serve.

@pawamoy
Copy link
Member

pawamoy commented Apr 9, 2020

It's probably because you didn't define your site_url in mkdocs.yml.

I didn't find a better way than using page.canonical_url (which is None if site_url isn't defined) to build the links for cross-references that works both while serving and building.

I guess we should at least catch the exception to issue an error.

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

2 participants