Closed lukasreussner closed 5 years ago
Can you post the output of locale
please? It seems like your locales are messed up... UTF-8 is definitely not a valid locale.
What version of MacOS are you running? What are your language settings?
Just fixed the local.
➜ mkdocs-material-master locale LANG= LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL="en_US.UTF-8"
However, now I'm getting this error:
➜ mkdocs-material-master mkdocs build Traceback (most recent call last): File "/usr/local/bin/mkdocs", line 11, in <module> sys.exit(cli()) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/mkdocs/__main__.py", line 163, in build_command ), dirty=not clean) File "/usr/local/lib/python3.7/site-packages/mkdocs/commands/build.py", line 240, in build config = config['plugins'].run_event('config', config) File "/usr/local/lib/python3.7/site-packages/mkdocs/plugins.py", line 94, in run_event result = method(item, **kwargs) File "/usr/local/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/plugin.py", line 31, in on_config self.renderer = Renderer(config['theme'].name) File "/usr/local/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/renderer.py", line 12, in __init__ self.theme = self._load_theme_handler(theme) File "/usr/local/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/renderer.py", line 33, in _load_theme_handler module_name = '.' + theme.replace('-', '_') AttributeError: 'NoneType' object has no attribute 'replace'
The reason for this is that this repository is actually setting the theme
to null
and using the custom_dir
option instead. This makes sense for the material theme repo, since it obviously uses itself as the theme.
For this case, I'll have to fallback to the generic renderer. This will however break the PDF export for this repository, since it requires the material theme stylesheet I provide to work.
At this point it's probably best to just switch to your own repository for further testing.
Changing the repository and setting the theme doesn't solve the problem. Just tried it and got the same error when executing mkdocs build
:
That was my mkdocs.yml
:
`site_name: My Docs nav:
I fixed an issue when the enabled_if_env option is not set. Can you please re-test with v0.2.2? It should be up on pypi in about 5 minutes.
The exception above looks like the theme is still unset though, so if you get the same exception, please make sure you have a theme set.
And handling for empty theme should also be fixed.
I get the following error when executing
mkdocs build
whilepdf-export
is enabled.➜ mkdocs-material-master mkdocs build Traceback (most recent call last): File "/usr/local/bin/mkdocs", line 11, in <module> sys.exit(cli()) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/mkdocs/__main__.py", line 162, in build_command site_dir=site_dir File "/usr/local/lib/python3.7/site-packages/mkdocs/config/base.py", line 197, in load_config errors, warnings = cfg.validate() File "/usr/local/lib/python3.7/site-packages/mkdocs/config/base.py", line 107, in validate run_failed, run_warnings = self._validate() File "/usr/local/lib/python3.7/site-packages/mkdocs/config/base.py", line 62, in _validate self[key] = config_option.validate(value) File "/usr/local/lib/python3.7/site-packages/mkdocs/config/config_options.py", line 132, in validate return self.run_validation(value) File "/usr/local/lib/python3.7/site-packages/mkdocs/config/config_options.py", line 572, in run_validation plgins[item] = self.load_plugin(item, cfg) File "/usr/local/lib/python3.7/site-packages/mkdocs/config/config_options.py", line 580, in load_plugin Plugin = self.installed_plugins[name].load() File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2325, in load return self.resolve() File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2331, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/local/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/plugin.py", line 8, in <module> from weasyprint import HTML, urls File "/usr/local/lib/python3.7/site-packages/weasyprint/__init__.py", line 375, in <module> from .css import preprocess_stylesheet # noqa File "/usr/local/lib/python3.7/site-packages/weasyprint/css/__init__.py", line 30, in <module> from .descriptors import preprocess_descriptors File "/usr/local/lib/python3.7/site-packages/weasyprint/css/descriptors.py", line 20, in <module> from .validation import ( File "/usr/local/lib/python3.7/site-packages/weasyprint/css/validation.py", line 25, in <module> from ..images import LinearGradient, RadialGradient File "/usr/local/lib/python3.7/site-packages/weasyprint/images.py", line 20, in <module> import cairosvg.parser File "/usr/local/lib/python3.7/site-packages/cairosvg/__init__.py", line 29, in <module> from . import surface File "/usr/local/lib/python3.7/site-packages/cairosvg/surface.py", line 27, in <module> from .defs import ( File "/usr/local/lib/python3.7/site-packages/cairosvg/defs.py", line 24, in <module> from .bounding_box import calculate_bounding_box, is_non_empty_bounding_box File "/usr/local/lib/python3.7/site-packages/cairosvg/bounding_box.py", line 26, in <module> from .features import match_features File "/usr/local/lib/python3.7/site-packages/cairosvg/features.py", line 25, in <module> LOCALE = locale.getdefaultlocale()[0] or '' File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/locale.py", line 568, in getdefaultlocale return _parse_localename(localename) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/locale.py", line 495, in _parse_localename raise ValueError('unknown locale: %s' % localename) ValueError: unknown locale: UTF-8
For reproduction: I used the https://github.com/squidfunk/mkdocs-material Repro for testing purposes.