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

build failing with 9.1.10 #5487

Closed
4 tasks done
Syn-Tax opened this issue May 8, 2023 · 10 comments
Closed
4 tasks done

build failing with 9.1.10 #5487

Syn-Tax opened this issue May 8, 2023 · 10 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@Syn-Tax
Copy link

Syn-Tax commented May 8, 2023

Context

build fails with version 9.1.10 - nothing changed on our end from 9.1.9 when it all worked perfectly! Error received in Bug Description

Bug description

When building with github actions - https://github.com/Digital-Controllers/website/blob/main/.github/workflows/ci.yml (NOTE: we've had to force it to use 9.1.9 because of this - that version works fine) - we get the following error:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.3/x64/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 1[13](https://github.com/Digital-Controllers/website/actions/runs/4917745301/jobs/8783209150#step:7:14)0, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line [14](https://github.com/Digital-Controllers/website/actions/runs/4917745301/jobs/8783209150#step:7:15)04, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/mkdocs/__main__.py", line 277, in gh_deploy_command
    build.build(cfg, dirty=not clean)
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/mkdocs/commands/build.py", line 270, in build
    config = config.plugins.run_event('config', config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/mkdocs/plugins.py", line 5[20](https://github.com/Digital-Controllers/website/actions/runs/4917745301/jobs/8783209150#step:7:21), in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 92, in on_config
    value = self.config.cards_color.get("fill")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

This does not change when running it locally.

Related links

  • Reporting a bug
  • can't find anything relating to updating to 9.1.10 unforutnately

Reproduction

unfortunately, due to 9.1.10 being very new, when attempting to create a minimal reproduction, it's wanting us to update to 9.1.9 which as stated before worked perfectly!

Steps to reproduce

  1. install mkdocs-material version 9.1.10
  2. build documentation (can be found at https://github.com/Digital-Controllers/website)

Browser

No response

Before submitting

@vedranmiletic
Copy link
Contributor

You will need to remove all customizations and attach the .zip with minimal reproduction. While trying doing that myself, I encountered another issue so there is no example.zip, just the file contents below. I will report that separately.

mkdocs.yml:

site_name: My Docs
theme:
  name: material
plugins:
  - social

docs/index.md

# Lorem ipsum

This produces:

mkdocs build 
INFO     -  DeprecationWarning: Use setlocale(), getencoding() and getlocale() instead
              File "/usr/lib/python3.11/site-packages/cairosvg/features.py", line 9, in <module>
                LOCALE = locale.getdefaultlocale()[0] or ''
              File "/usr/lib/python3.11/locale.py", line 559, in getdefaultlocale
                warnings.warn(
Traceback (most recent call last):
  File "/home/vedranm/.local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/mkdocs/__main__.py", line 250, in build_command
    build.build(cfg, dirty=not clean)
  File "/home/vedranm/.local/lib/python3.11/site-packages/mkdocs/commands/build.py", line 270, in build
    config = config.plugins.run_event('config', config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/mkdocs/plugins.py", line 520, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vedranm/.local/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 92, in on_config
    value = self.config.cards_color.get("fill")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

@Syn-Tax
Copy link
Author

Syn-Tax commented May 8, 2023

That is exactly the error that I am reporting kind sir! - following your steps does not produce any different outcome.

@vedranmiletic
Copy link
Contributor

That is exactly the error that I am reporting kind sir! - following your steps does not produce any different outcome.

Correct. The difference is, my example has been minimized per reproduction instructions, which saves developer time.

@MAGICCC
Copy link

MAGICCC commented May 8, 2023

Indeed I get the same error, following the reproduction instructions does not work because of #5488

Furthermore I suspect the if clause is not doing its job:

value = self.config.cards_color.get("fill")

I do use an array for the colors:

  palette:
   - scheme: default
     primary: indigo
     accent: orange
     toggle:
       icon: material/weather-night
       name: Switch to dark mode
   - scheme: slate
     primary: indigo
     accent: orange
     toggle:
       icon: material/weather-sunny
       name: Switch to light mode

@squidfunk
Copy link
Owner

Thanks for reporting and sorry for the trouble this was causing. Should all be fixed in 8b50290. Can you confirm?

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open labels May 8, 2023
@MAGICCC
Copy link

MAGICCC commented May 8, 2023

Thanks for reporting and sorry for the trouble this was causing. Should all be fixed in 8b50290. Can you confirm?

Thanks for the quick fix!
Yes using a minimal config - except the info plugin and only the social plugin - the build passed.

EDIT: Even with the full project the build passed

Maybe for @vedranmiletic:
You can install the commit using pip install 'mkdocs-material @ https://github.com/squidfunk/mkdocs-material/commit/8b50290f5e2f4dcc35264deae2f88fd82106bfbf' (first unistall your current mkdocs-material version to avoid issues)

@squidfunk
Copy link
Owner

9.1.11 is out which includes the fix.

@vedranmiletic
Copy link
Contributor

Thanks for reporting and sorry for the trouble this was causing. Should all be fixed in 8b50290. Can you confirm?

Thanks for the quick fix! Yes using a minimal config - except the info plugin and only the social plugin - the build passed.

EDIT: Even with the full project the build passed

I confirm the same.

Maybe for @vedranmiletic: You can install the commit using pip install 'mkdocs-material @ https://github.com/squidfunk/mkdocs-material/commit/8b50290f5e2f4dcc35264deae2f88fd82106bfbf' (first unistall your current mkdocs-material version to avoid issues)

Thanks! I figured by trial and error that pip install . after cloning the repo also works.

@rfay
Copy link

rfay commented Mar 3, 2024

Just a note that you can get this error if you accidentally have a misconfigured header. For example:

---
search:
boost: 1.0
---

which should be with boost indented:

---
search:
  boost: 1.0
---

Here's the resulting and very mysterious error:

$ mkdocs serve
INFO    -  Building documentation...
INFO    -  Cleaning site directory
ERROR   -  Error building page 'users/usage/faq.md': 'NoneType' object has no
           attribute 'get'
Traceback (most recent call last):
  File "/opt/homebrew/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/__main__.py", line 270, in serve_command
    serve.serve(**kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 86, in serve
    builder(config)
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 67, in builder
    build(config, live_server=None if is_clean else server, dirty=is_dirty)
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/build.py", line 349, in build
    _build_page(
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/commands/build.py", line 222, in _build_page
    context = config.plugins.on_page_context(context, page=page, config=config, nav=nav)
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/plugins.py", line 583, in on_page_context
    return self.run_event('page_context', context, page=page, config=config, nav=nav)
  File "/opt/homebrew/lib/python3.9/site-packages/mkdocs/plugins.py", line 507, in run_event
    result = method(item, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/material/plugins/search/plugin.py", line 116, in on_page_context
    self.search_index.add_entry_from_context(page)
  File "/opt/homebrew/lib/python3.9/site-packages/material/plugins/search/plugin.py", line 168, in add_entry_from_context
    if search.get("exclude"):
AttributeError: 'NoneType' object has no attribute 'get'

@squidfunk
Copy link
Owner

@rfay should be fixed with 15f1506.

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

5 participants