jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Faulty call to _message_box in pdf.py

Open paulremo opened this issue 3 years ago • 0 comments

Describe the bug

context When modifying the _config.yml file to include a custom sphinx:config:latex_documents list, the jupyter-book build command fails.

expectation I expected a document to be generated.

bug But instead, the build command returns the error message:

File "..\jupyter_book\sphinx.py", line 138, in build_sphinx
  new_latex_documents = update_latex_documents(
File "..\jupyter_book\pdf.py", line 80, in update_latex_documents
  _message_box(
File "..\jupyter_book\utils.py", line 30, in _message_box
  border_colored = _color_message(border, color)
File "..\jupyter_book\utils.py", line 22, in _color_message
  return bcolors[style] + msg + endc
KeyError: 'This suggests the user has made custom settings to their build'

cause The bug is caused by a faulty call to _message_box inside pdf.py. The three lines of the message are passed as three separate arguments to the function in:

_message_box(
    "Latex documents specified as a multi element list in the _config",
    "This suggests the user has made custom settings to their build",
    "[Skipping] processing of automatic latex overrides",
)

fix The bug could be fixed by changing the call to _message_box to:

_message_box(
    "Latex documents specified as a multi element list in the _config\n This suggests the user has made custom settings to their build \n [Skipping] processing of automatic latex overrides",
)

Reproduce the bug

  1. Add any custom sphinx:config:latex_documents list with more than one element
  2. Run the jb build command

List your environment

No response

paulremo avatar Aug 30 '22 09:08 paulremo