Describe the bug
There seems to be a circular import problem when trying to import sphinxcontrib.serializinghtml.
To Reproduce
Steps to reproduce the behavior:
$ docker run -it --rm --entrypoint bash python:3.7
# Install sphinx & sphinxcontrib-serializinghtml
root@5a4dc3112f09:/# python3 -m pip install sphinx==2.0.0 sphinxcontrib-serializinghtml==1.1.1
...
Successfully installed Jinja2-2.10 MarkupSafe-1.1.1 Pygments-2.3.1 alabaster-0.7.12 babel-2.6.0 certifi-2019.3.9 chardet-3.0.4 docutils-0.14 idna-2.8 imagesize-1.1.0 packaging-19.0 pyparsing-2.3.1 pytz-2018.9 requests-2.21.0 six-1.12.0 snowballstemmer-1.2.1 sphinx-2.0.0 sphinxcontrib-applehelp-1.0.1 sphinxcontrib-devhelp-1.0.1 sphinxcontrib-htmlhelp-1.0.1 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.2 sphinxcontrib-serializinghtml-1.1.1 urllib3-1.24.1
# Attempt to import, fails
root@5a4dc3112f09:/# python3
Python 3.7.3 (default, Mar 27 2019, 23:40:30)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sphinxcontrib.serializinghtml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/sphinxcontrib/serializinghtml/__init__.py", line 15, in <module>
from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder
File "/usr/local/lib/python3.7/site-packages/sphinx/builders/html.py", line 1237, in <module>
from sphinxcontrib.serializinghtml import ( # NOQA
ImportError: cannot import name 'LAST_BUILD_FILENAME' from 'sphinxcontrib.serializinghtml' (/usr/local/lib/python3.7/site-packages/sphinxcontrib/serializinghtml/__init__.py)
# Import sphinx.builders.html first, things work
>>> import sphinx.builders.html
>>> import sphinxcontrib.serializinghtml
>>>
Expected behavior
No other imports should be required before sphinxcontrib.serializinghtml.
Environment info
Python version: [e.g. 3.7.1]
root@5a4dc3112f09:/# python3 -V
Python 3.7.3
Sphinx version: [e.g. 1.8.2]
Fixed by #6249 and sphinx-doc/sphinxcontrib-serializinghtml#1 (No.1!!)
Thank you for reporting :-)
Actually, it looks like I'm still hitting the same problem -- the new code you've added isn't used until after the failing import.
Notebook with repro: https://colab.research.google.com/drive/1PmL2l3f3BwAhwxmaEeM52XxE1fqksiML
Same as @craigcitro, I can't run Sphinx at all because the circular import still exists:
@ProgVal Could you file a new issue please? I'll check it later.
Most helpful comment
Fixed by #6249 and sphinx-doc/sphinxcontrib-serializinghtml#1 (No.1!!)
Thank you for reporting :-)