otter-grader
otter-grader copied to clipboard
Make xeCJK opt-in behavior
Make the use of the xeCJK template for Otter Export opt-in only. Currently, if PDF generation fails, Otter Export automatically tries again with xeCJK enabled, and then only shows the error message generated by the xeCJK template. Instead, this retry should not happen automatically, and instead the xecjk
argument should be used to determine whether to use the xeCJK template or not. This would need to be added as an argument to functions that call Otter Export (e.g. otter.Notebook.export
). This also means that no_xecjk
/--no-xecjk
can be removed.
I think I am running into this problem now. During the export to PDF part of the otter assign process, I am getting this error when the process tries to generate template pdfs -- the solution pdfs work fine.
Here is the stack trace:
=====
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/otter/export/exporters/via_latex.py", line 69, in convert_notebook pdf_output = nbconvert.export(pdf_exporter, nb) File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 86, in export output, resources = exporter_instance.from_notebook_node(nb, resources) File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/nbconvert/exporters/pdf.py", line 200, in from_notebook_node raise LatexFailed("\n".join(self._captured_output)) nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output: This is BibTeX, Version 0.99d (TeX Live 2022/Homebrew) The top-level auxiliary file: notebook.aux I found no \citation commands---while reading file notebook.aux I found no \bibdata command---while reading file notebook.aux I found no \bibstyle command---while reading file notebook.aux (There were 3 error messages)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sean/Documents/cb/venv-assignments-new/bin/otter", line 8, in
If the error above is related to xeCJK or fandol in LaTeX and you don't require this functionality, try running again with no_xecjk set to True or the --no-xecjk flag.
=======
Am I doing something wrong to get this error at all?
I tried updating the system's TeXLive.
Errors like
I found no \citation commands---while reading file notebook.aux
I found no \bibdata command---while reading file notebook.aux
I found no \bibstyle command---while reading file notebook.aux
(There were 3 error messages)
are usually caused by empty LaTeX being sent to nbconvert for export. Are there any manually-graded questions (i.e. is there any content between <!-- BEGIN QUESTION -->
and <!-- END QUESTION -->
comments) in your notebook?
Ok, I think I have it narrowed down @chrispyles.
In otter-grader 3.3.0 we actually see the error but it does not stop the process:
In otter-grader 4.1.0, the process is killed. I pasted the stacktrace below.
On a whim, I decided to add a manually graded problem to the notebook -- there were none in the lab -- and now there is no error. It looks like the if your template_pdf attribute is set to true on a notebook with no manually-graded questions the LaTex processor freaks out. In otter-grader 3.3.0 this was not show stopping but in otter-grader 4.1.0 it is. I am not quite sure why that is the case.
otter-grader 4.1.0: otter assign output(with manually graded question): INFO otter.assign.main] Generating views [INFO otter.assign.main] Generating autograder zipfile [INFO otter.assign.main] Generating solutions PDF [INFO otter.assign.main] Generating template PDF [INFO otter.assign.main] Running tests against the solutions notebook [INFO otter.check.notebook.Notebook.grading_mode] Entering Notebook grading mode [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_2_1_2 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_2_3_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_2_3_2 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_3_1_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_4_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_4_1_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_2_1_2 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_2_3_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_2_3_2 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_3_1_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_4_1 [INFO otter.check.notebook.Notebook.check] Running check for question: q1_2_4_1_1 [INFO otter.check.notebook.Notebook.grading_mode] Exiting Notebook grading mode [INFO otter.assign.main] All autograder tests passed.
otter-grader 4.1.0: otter assign output(with no manually graded questions): [INFO otter.assign.main] Generating views [INFO otter.assign.main] Generating autograder zipfile [INFO otter.assign.main] Generating solutions PDF [INFO otter.assign.main] Generating template PDF Traceback (most recent call last): File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/otter/export/exporters/via_latex.py", line 69, in convert_notebook pdf_output = nbconvert.export(pdf_exporter, nb) File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 86, in export output, resources = exporter_instance.from_notebook_node(nb, resources) File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/nbconvert/exporters/pdf.py", line 200, in from_notebook_node raise LatexFailed("\n".join(self._captured_output)) nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output: This is BibTeX, Version 0.99d (TeX Live 2022/Homebrew) The top-level auxiliary file: notebook.aux I found no \citation commands---while reading file notebook.aux I found no \bibdata command---while reading file notebook.aux I found no \bibstyle command---while reading file notebook.aux (There were 3 error messages)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/otter/export/exporters/via_latex.py", line 69, in convert_notebook pdf_output = nbconvert.export(pdf_exporter, nb) File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 86, in export output, resources = exporter_instance.from_notebook_node(nb, resources) File "/Users/sean/Documents/cb/venv-assignments-new/lib/python3.9/site-packages/nbconvert/exporters/pdf.py", line 200, in from_notebook_node raise LatexFailed("\n".join(self._captured_output)) nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output: This is BibTeX, Version 0.99d (TeX Live 2022/Homebrew) The top-level auxiliary file: notebook.aux I found no \citation commands---while reading file notebook.aux I found no \bibdata command---while reading file notebook.aux I found no \bibstyle command---while reading file notebook.aux (There were 3 error messages)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sean/Documents/cb/venv-assignments-new/bin/otter", line 8, in
If the error above is related to xeCJK or fandol in LaTeX and you don't require this functionality, try running again with no_xecjk set to True or the --no-xecjk flag.
On a whim, I decided to add a manually graded problem to the notebook -- there were none in the lab -- and now there is no error.
Yes, from my last note, this is expected. If there are no manually graded questions, when Otter filters the notebook, there won't be anything left in the notebook, and LaTeX (or whatever flavor of it nbconvert uses) errors when there's nothing to render.
In otter-grader 3.3.0 this was not show stopping but in otter-grader 4.1.0 it is.
Yes, this was an intentional change to be able to surface these errors to students on Gradescope when there are errors generating a PDF of their submission.
Great thanks -- ok. Didn't catch this was done on purpose. I am good.