KeyboardInterrupt during search index generation isn't safe

Anonymous avatarAnonymous created an issue

I was working on the Python docs and ran Sphinx:

writing output... c-api/objimpl c-api/structures contents license writing additional files... genindex modindex search download index opensearch copying static files... done dumping search index... ^Cmake: * [build] Error 1

(Notice the interrupt)

The next time I got this:

pickling environment... done checking consistency... done preparing documents... WARNING: search index couldn't be loaded, but not all documents will be built: the index will be incomplete. done writing output... c-api/objimpl c-api/structures contents writing additional files... genindex modindex search download index opensearch copying static files... done dumping search index... Exception occurred: File "/temp/python/trunk/Doc/tools/sphinx/search.py", line 151, in get_descrefs pdict[name] = (fn2index[doc], i) KeyError: 'library/ic'

Traceback (most recent call last): File "/temp/python/trunk/Doc/tools/sphinx/cmdline.py", line 151, in main app.build(all_files, filenames) File "/temp/python/trunk/Doc/tools/sphinx/application.py", line 143, in build self.builder.build_update() File "/temp/python/trunk/Doc/tools/sphinx/builders/init.py", line 236, in build_update 'out of date' % len(to_build)) File "/temp/python/trunk/Doc/tools/sphinx/builders/init.py", line 281, in build self.finish() File "/temp/python/trunk/Doc/tools/sphinx/builders/html.py", line 409, in finish self.handle_finish() File "/temp/python/trunk/Doc/tools/sphinx/builders/html.py", line 500, in handle_finish self.indexer.dump(f, self.indexer_format) File "/temp/python/trunk/Doc/tools/sphinx/search.py", line 132, in dump format.dump(self.freeze(), stream) File "/temp/python/trunk/Doc/tools/sphinx/search.py", line 173, in freeze descrefs=self.get_descrefs(fn2index), File "/temp/python/trunk/Doc/tools/sphinx/search.py", line 151, in get_descrefs pdict[name] = (fn2index[doc], i) KeyError: 'library/ic'

Of course, this was easily cured by deleting the doctrees, but it would be nice if Sphinx could be safely interrupted anywhere.

Thanks, Benjamin

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.