Skip to content

Commit f355a46

Browse files
committed
Backport: Fix is_knitr_engine check for quarto == 1.8.26
closes #1017 ref: quarto-dev/quarto-cli#13613
1 parent b747488 commit f355a46

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

doc/changelog.qmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ title: Changelog
33
---
44

55
## v0.15.1
6-
(2025-09-30)
6+
(2025-12-12)
7+
8+
### Bug Fixes
9+
10+
- Fixed random failures for when using plotnine in quarto == 1.8.26. {{< issue 1017 >}}
711

812
### New
913

plotnine/_utils/quarto.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ def is_knitr_engine() -> bool:
4747
import json
4848
from pathlib import Path
4949

50-
info = json.loads(Path(filename).read_text())
51-
return info["format"]["execute"]["engine"] == "knitr"
50+
try:
51+
info = json.loads(Path(filename).read_text())
52+
except FileNotFoundError:
53+
# NOTE: Remove this branch some time after quarto 1.9 is released
54+
# https://github.com/quarto-dev/quarto-cli/issues/13613
55+
return "rpytools" in sys.modules
56+
return info["format"]["execute"].get("engine") == "knitr"
5257
else:
5358
# NOTE: Remove this branch some time after quarto 1.9 is released
5459
return "rpytools" in sys.modules

0 commit comments

Comments
 (0)