-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Bug description
I have a Quarto document with a code chunk with #| error: true
and Python code that raises an exception.
With the jupyter
engine, rendering to html is fine, but rendering to pdf inserts some odd characters (perhaps something Unicode-related) into the intermediate LaTeX file that prevents rendering to pdf.
Using the knitr
engine works fine.
Steps to reproduce
---
title: "foo"
---
```{python}
#| error: true
def myfun(val):
if val <= 0:
raise ValueError()
myfun(-3)
```
Expected behavior
I run:
quarto render file.qmd --debug --to pdf
I expect a pdf to be produced, containing the Python error message and traceback.
Actual behavior
Starting python3 kernel...Done
Executing 'test2.quarto_ipynb'
Cell 1/1: ''...Done
pandoc
to: latex
output-file: test2.tex
standalone: true
pdf-engine: xelatex
variables:
graphics: true
tables: true
default-image-extension: pdf
metadata
documentclass: scrartcl
classoption:
- DIV=11
- numbers=noendperiod
papersize: letter
header-includes:
- '\KOMAoption{captions}{tableheading}'
block-headings: true
title: foo
Rendering PDF
running xelatex - 1
This is XeTeX, Version 3.141592653-2.6-0.999996 (TeX Live 2024) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
updating tlmgr
updating existing packages
ERROR:
compilation failed- error
Text line contains an invalid character.
l.216 ^^[
[0;31m-------------------------------------------------------------...
If I look in the .tex file, I see that the output related to the exception has invalid characters:
\begin{verbatim}
ValueError: `val` positive
ESC[0;31m---------------------------------------------------------------------------ESC[0m
ESC[0;31mValueErrorESC[0m Traceback (most recent call last)
Cell ESC[0;32mIn[1], line 4ESC[0m
ESC[1;32m 1ESC[0m ESC[38;5;28;01mdefESC[39;00m ESC[38;5;21mmyfunESC[39m(val):
ESC[1;32m 2ESC[0m ESC[38;5;28;01mraiseESC[39;00m ESC[38;5;167;01mValueErrorESC[39;00m(ESC[38;5;124m"ESC[39mESC[38;5;124m`val` positiveESC[39mESC[38;5;124m"ESC[39m)
ESC[0;32m----> 4ESC[0m ESC[43mmyfunESC[49mESC[43m(ESC[49mESC[38;5;241;43m-ESC[39;49mESC[38;5;241;43m3ESC[39;49mESC[43m)ESC[49m
Cell ESC[0;32mIn[1], line 2ESC[0m, in ESC[0;36mmyfunESC[0;34m(val)ESC[0m
ESC[1;32m 1ESC[0m ESC[38;5;28;01mdefESC[39;00m ESC[38;5;21mmyfunESC[39m(val):
ESC[0;32m----> 2ESC[0m ESC[38;5;28;01mraiseESC[39;00m ESC[38;5;167;01mValueErrorESC[39;00m(ESC[38;5;124m"ESC[39mESC[38;5;124m`val` positiveESC[39mESC[38;5;124m"ESC[39m)
ESC[0;31mValueErrorESC[0m: `val` positive
\end{verbatim}
Your environment
Ubuntu 22.04 (or Rocky 8)
Quarto 1.5.54 (or Quarto 1.5.57).
No IDE -- Quarto run from the shell.
Quarto check output
When I set up a minimal Docker container with R 4.1.2, Miniconda3, and Quarto 1.5.57, see output below.
I get the same issue on a production server with R 4.4.0, Miniconda3 and Quarto 1.5.54, as well as on a production server with Rocky 8, Anaconda3, Quarto 1.5.57.
Quarto 1.5.57
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.5.57
Path: /opt/quarto-1.5.57/bin
[✓] Checking tools....................OK
TinyTeX: v2024.09
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /root/.TinyTeX/bin/x86_64-linux
Version: 2024
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.6 (Conda)
Path: /opt/miniforge/bin/python
Jupyter: 5.7.2
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.1.2
Path: /usr/lib/R
LibPaths:
- /usr/local/lib/R/site-library
- /usr/lib/R/site-library
- /usr/lib/R/library
knitr: 1.48
rmarkdown: 2.28
[✓] Checking Knitr engine render......OK