-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open
Description
Context
I recently tried adding the optimize
plugin to work with a variety of PNGs I use on https://distant.dev/. It appears that I am hitting the issue described in #5098, so taking a stab at reporting it.
I'm using commit fa5bd3f45024328d973977db80cccd5b1df89228
of Insiders.
Bug description
Running mkdocs build
or mkdocs serve
with the optimize
plugin configured within mkdocs.yml
results in a FileNotFoundError
.
❯ mkdocs build
INFO - [macros] - Macros arguments: {'module_name': 'macros', 'modules': [], 'render_by_default': True, 'include_dir': '',
'include_yaml': [], 'j2_block_start_string': '', 'j2_block_end_string': '', 'j2_variable_start_string': '', 'j2_variable_end_string': '',
'on_undefined': 'strict', 'on_error_fail': True, 'verbose': False}
INFO - [macros] - Found local Python module 'macros' in: /Users/senkwich/projects/distant.dev
INFO - [macros] - Found external Python module 'macros' in: /Users/senkwich/projects/distant.dev
INFO - [macros] - Extra filters (module): ['pretty']
INFO - Cleaning site directory
INFO - Building documentation to directory: /Users/senkwich/projects/distant.dev/site
Optimizations:
Traceback (most recent call last):
File "/Users/senkwich/Library/Python/3.9/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/mkdocs/__main__.py", line 250, in build_command
build.build(cfg, dirty=not clean)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/mkdocs/commands/build.py", line 332, in build
config.plugins.run_event('post_build', config=config)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/mkdocs/plugins.py", line 522, in run_event
result = method(**kwargs)
File "/Users/senkwich/Library/Python/3.9/lib/python/site-packages/material/plugins/optimize/plugin.py", line 113, in on_post_build
size_opt += os.path.getsize(target)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/genericpath.py", line 50, in getsize
return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: '.cache/plugin/optimize/assets/favicon.png'
Related links
Reproduction
I've removed everything but a blank index.md
page as it appears unrelated to which images are actual referenced. Additionally, I cleared out the majority of images and other assets alongside all css and javascript.
mkdocs.yml
nav:
- 'index.md'
theme:
name: material
favicon: assets/favicon.png
logo: assets/logo.svg
plugins:
- optimize
Steps to reproduce
- Create a couple of PNGs in the assets directory
- For me, a minimal layout is
assets/ favicon.png logo.svg images/ architecture/ picture.png
- For me, a minimal layout is
- Attempt to run
mkdocs build
ormkdocs serve
- Observe error about a file not existing in the
.cache
directory- In my case, there is a path to
.cache/plugin/optimize/assets/images/architecture
without anything inside, nor anything else in the parent directories.
- In my case, there is a path to
Browser
No response
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction.
JuLeeAtPlanet
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open