Skip to content

Python 3.11: "WARNING: image file not readable" #10030

@hugovk

Description

@hugovk

Describe the bug

I have two images, in these directories:

  • docs/example/
  • Tests/images/

I am referencing these from docs/index.rst and docs/handbook/index.rst.

With Python 3.11:

  • docs/index.rst can load both images
  • docs/handbook/index.rst can load the docs/example/ image
  • docs/handbook/index.rst cannot load the Tests/images/ image

Python 3.10 and lower loads both images from both locations with no problem.

How to Reproduce

$ git clone https://github.com/hugovk/test
$ cd test
$ git checkout 3.11-sphinx
$ python3.11 -m pip install sphinx
$ python3.10 -m pip install sphinx
$ cd docs
$ SPHINXBUILD=/Users/hugo/.pyenv/versions/3.11-dev/bin/sphinx-build make html # update for your 3.11 path
Running Sphinx v4.3.2
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] index
/Users/hugo/github/test/docs/handbook/index.rst:: WARNING: image file not readable: Tests/images/test_anchor_quick_ms.png
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex done
writing additional pages... search done
copying images... [100%] ../Tests/images/test_anchor_quick_ms.png
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build finished with problems, 1 warning.
make: *** [html] Error 1
$ # open _build/html/index.html - both images shown (from docs/example and Tests/images
$ # open _build/html/handbook/index.html - only docs/example image is shown but Tests/images is not
$ rm -rf build
$ SPHINXBUILD=/Library/Frameworks/Python.framework/Versions/3.10/bin/sphinx-build make html # update for your 3.10 path
Running Sphinx v4.3.2
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex done
writing additional pages... search done
copying images... [100%] ../Tests/images/test_anchor_quick_ms.png
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.
$ # open _build/html/index.html - both images shown
$ # open _build/html/handbook/index.htm - both images shown

Expected behavior

Both images loaded from both pages with Python 3.11.

Your project

https://github.com/hugovk/test/tree/3.11-sphinx

Screenshots

Python 3.11

docs/index.html

image

docs/handbook/index.html

image

Python 3.10

docs/index.html

image

docs/handbook/index.html

image

OS

macOS and Ubuntu

Python version

Python 3.11.0a3

Sphinx version

4.3.2

Sphinx extensions

No response

Extra tools

No response

Additional context

Docs built with -W --keep-going.

See also https://github.com/hugovk/test/actions/runs/1636902235 for CI reproducing the problem with the minimal reproduction on 3.11 but not 3.7-3.10.

https://github.com/python-pillow/Pillow is the real project where I encountered the problem, and https://github.com/hugovk/Pillow/runs/4653349016?check_suite_focus=true is a CI build demonstrating it.

No rush at all to build for 3.11 (due for release in October 2022), just a heads-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions