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

Error if you have a notebook called search.ipynb #1572

Open
AllenDowney opened this issue Dec 19, 2021 · 1 comment
Open

Error if you have a notebook called search.ipynb #1572

AllenDowney opened this issue Dec 19, 2021 · 1 comment

Comments

@AllenDowney
Copy link

I've got this down to a minimal document with this TOC:

format: jb-article
root: search

In the same directory, I've got a notebook called search.ipynb that has a single text cell.

When I run

jb build .

I get the following errors:

Running Jupyter-Book v0.12.0
Source Folder: /home/downey/DSIRP/jb2
Config Path: /home/downey/DSIRP/jb2/_config.yml
Output Path: /home/downey/DSIRP/jb2/_build/html
Running Sphinx v4.2.0
[etoc] Changing master_doc to 'search'
myst v0.15.2: MdParserConfig(renderer='sphinx', commonmark_only=False, enable_extensions=['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist'], dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', disable_syntax=[], url_schemes=['mailto', 'http', 'https'], heading_anchors=None, heading_slug_func=None, html_meta=[], footnote_transition=True, substitutions=[], sub_delimiters=['{', '}'], words_per_minute=200)
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] search                                                
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] search                                                 
Theme error:
An error happened in rendering the page search.
Reason: ValueError('Landing page missing a title: search')
Traceback (most recent call last):
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/html/__init__.py", line 1055, in handle_page
    output = self.templates.render(templatename, ctx)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/jinja2glue.py", line 196, in render
    return self.environment.get_template(template).render(context)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/themes/basic/page.html", line 10, in top-level template code
    {%- extends "layout.html" %}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/layout.html", line 7, in top-level template code
    {%- set sidebar_width_class = "col-md-3" %}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/../pydata_sphinx_theme/layout.html", line 10, in top-level template code
    <a class='right-next' id="next-link" href="{{ next.link|e }}" title="{{ _('next page')}}">{{ next_title or next.title }}</a>
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/themes/basic/../basic/layout.html", line 169, in top-level template code
    {%- block content %}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/../pydata_sphinx_theme/layout.html", line 57, in block 'content'
    {% block docs_sidebar %}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/layout.html", line 14, in block 'docs_sidebar'
    {% include "sidebar.html" %}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/sidebar.html", line 2, in top-level template code
    {%- include sidebartemplate %}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/_templates/sbt-sidebar-nav.html", line 3, in top-level template code
    {{ sbt_generate_nav_html(include_item_names=True, with_home_page=theme_home_page_in_toc, show_depth=theme_show_navbar_depth) }}
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx_book_theme/__init__.py", line 112, in sbt_generate_nav_html
    raise ValueError(f"Landing page missing a title: {master_doc}")
ValueError: Landing page missing a title: search

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/jupyter_book/sphinx.py", line 167, in build_sphinx
    app.build(force_all, filenames)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/application.py", line 343, in build
    self.builder.build_update()
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 295, in build_update
    len(to_build))
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 357, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 531, in write
    self._write_serial(sorted(docnames))
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 541, in _write_serial
    self.write_doc(docname, doctree)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/html/__init__.py", line 632, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/sphinx/builders/html/__init__.py", line 1063, in handle_page
    (pagename, exc)) from exc
sphinx.errors.ThemeError: An error happened in rendering the page search.
Reason: ValueError('Landing page missing a title: search')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/bin/jb", line 8, in <module>
    sys.exit(main())
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/jupyter_book/cli/main.py", line 320, in build
    result, builder, OUTPUT_PATH, build_type, PAGE_NAME, click.echo
  File "/home/downey/anaconda3/envs/SurvivalAnalysisPython/lib/python3.7/site-packages/jupyter_book/cli/main.py", line 519, in builder_specific_actions
    raise RuntimeError(_message_box(msg, color="red", doprint=False)) from result
RuntimeError: 
===============================================================================

There was an error in building your book. Look above for the cause.

===============================================================================

I get the sense that jb doesn't like it when the notebooks are in the same directory as the _toc and _config files.

I'm guessing the filename conflicts with something used by jb.

Anyway, this one took a while to debug!

@chrisjsewell
Copy link
Member

chrisjsewell commented Dec 19, 2021

Heya, yep this is an unfortunate issue with sphinx and also raised here: executablebooks/sphinx-external-toc#16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants