hummingbot/hummingbot-site

[BUG] Server start error after update

fengtality opened this issue · 3 comments

I updated the CoinAlpha fork of the Insiders build to latest. Afterwards, I got this when running mkdocs serve.

I created a new conda environment with only the mkdocs-material dependencies to try this:

# create new conda environment
(base) ➜ conda create -n mkdocs

# activate new environment
(base) ➜ conda activate mkdocs

# install pip
(mkdocs) ➜ conda install pip

# install mkdocs-material-insiders and dependencies
(mkdocs) ➜ pip install git+ssh://git@github.com/CoinAlpha/mkdocs-material-insiders

# install revision date plugin
(mkdocs)  ➜ pip install mkdocs-git-revision-date-plugin

# run server
(mkdocs) ➜  hummingbot-site git:(maintenance) ✗ mkdocs serve
INFO     -  Building documentation...
INFO     -  Cleaning site directory
ERROR    -  Error reading page 'maintenance/agreements.md': 'Regular'
Traceback (most recent call last):
  File "/Users/feng/anaconda3/envs/mkdocs/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/mkdocs/__main__.py", line 177, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 54, in serve
    config = builder()
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 49, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/mkdocs/commands/build.py", line 292, in build
    _populate_page(file.page, config, files, dirty)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/mkdocs/commands/build.py", line 170, in _populate_page
    page.markdown = config['plugins'].run_event(
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/mkdocs/plugins.py", line 102, in run_event
    result = method(item, **kwargs)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/material/plugins/social/plugin.py", line 120, in on_page_markdown
    image = self.__render_card(site_name, title, description)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/material/plugins/social/plugin.py", line 144, in __render_card
    font = ImageFont.truetype(self.font["Bold"], 36)
  File "/Users/feng/anaconda3/envs/mkdocs/lib/python3.9/site-packages/material/plugins/social/plugin.py", line 345, in <lambda>
    return defaultdict(lambda: font["Regular"], font)
KeyError: 'Regular'

I tried to reproduce it by pulling the latest version on a clean installation and everything works fine. Could you please remove the .cache directory created by the social plugin and see if the error persists? It looks like the plugin can't find the font.

@mifeng did you have a chance to check if purging the .cache directory fixes the issue at hand?? I'm pretty sure that's the problem. The reason for this is that at some point the way how fonts are downloaded was changed due to issues with character encodings, and this led to different font names being used.

Thanks, that fixed it!