sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Better crash messages when a file isn't found because it was removed by the user during the run

Open Pierre-Sassoulas opened this issue 3 years ago • 0 comments

Hello,

Thank you for working on Sphinx, I used this lib heavily for years.

I removed a file during the sphinx run and got the following crash:

Traceback (most recent call last):

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/cmd/build.py", line 276, in build_main

    app.build(args.force_all, filenames)

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/application.py", line 329, in build

    self.builder.build_update()

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 288, in build_update

    self.build(to_build,

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 352, in build

    self.write(docnames, list(updated_docnames), method)

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 544, in write

    self._write_serial(sorted(docnames))

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 554, in _write_serial

    self.write_doc(docname, doctree)

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 649, in write_doc

    self.handle_page(docname, ctx, event_arg=doctree)

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1098, in handle_page

    copyfile(self.env.doc2path(pagename), source_name)

  File "/home/pierre/pylint/venv/lib/python3.10/site-packages/sphinx/util/osutil.py", line 87, in copyfile

    if not path.exists(dest) or not filecmp.cmp(source, dest):

  File "/usr/lib/python3.10/filecmp.py", line 53, in cmp

    s1 = _sig(os.stat(f1))

FileNotFoundError: [Errno 2] No such file or directory: '/home/pierre/pylint/doc/user_guide/messages/warning/missing-pylint-confidence.rst'



Exception occurred:

  File "/usr/lib/python3.10/filecmp.py", line 53, in cmp

    s1 = _sig(os.stat(f1))

FileNotFoundError: [Errno 2] No such file or directory: '/home/pierre/pylint/doc/user_guide/messages/warning/missing-pylint-confidence.rst'

The full traceback has been saved in /tmp/sphinx-err-5ytmoq86.log, if you want to report the issue to the developers.

Please also report this if it was a user error, so that a better error message can be provided next time.

A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Describe the solution you'd like

Better error message without crash.

Describe alternatives you've considered

Not doing anything is reasonable too.

Pierre-Sassoulas avatar Aug 25 '22 11:08 Pierre-Sassoulas