quarto-dev / quarto-dev/quarto-cli
Compile quarto document in temporary directory in R fails when using `output_file = ...`
Open
@cscheid is already working on this.
Since Jun 17, 2024.
bug
files
needs-discussion
triaged-to
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
# This will create a file named "template.qmd" in the current folder.
# Used in: the "template.qmd" is a parametrized report and in a package. The report
# will be compiled in a temporary directly which will be cleaned afterwards.
f <- c("---", "title: \"Test\"", "format: html", "---", "", "## Set a variable",
"", "```{r}", "OK <- FALSE", "```", "", "## Running Code depending on value of `OK`",
"", "```{r}", "#| eval: !expr OK", "print(\"OK is TRUE - otherwise you won't see anything here.\")",
"```", "")
writeLines(f, "template.qmd")
name <- "Test_Report"
output_format <- "html"
output_file <- paste0(name, ".html")
tmpdir <- tempfile()
dir.create(tmpdir)
template <- file.path(tmpdir, "template.qmd")
file.copy(
file.path(".", "template.qmd"),
template
)
report <- quarto::quarto_render(
input = template,
output_format = output_format,
output_file = output_file
)
# Here the error occurs:
#
# processing file: template.qmd
# |.............. | 20%
# ordinary text without R code
#
# |............................ | 40%
# label: unnamed-chunk-1
# |.......................................... | 60%
# ordinary text without R code
#
# |........................................................ | 80%
# label: unnamed-chunk-2 (with options)
# List of 1
# $ eval: logi FALSE
#
# |......................................................................| 100%
# ordinary text without R code
#
#
# output file: template.knit.md
#
# pandoc --output ../../../../../../../Users/rainerkrug/tmp/test/Test_Report.html
# to: html
# standalone: true
# section-divs: true
# html-math-method: mathjax
# wrap: none
# default-image-extension: png
#
# metadata
# document-css: false
# link-citations: true
# date-format: long
# lang: en
# title: Test
#
# pandoc: ../../../../../../../Users/rainerkrug/tmp/test/Test_Report.html: openFile: does not exist (No such file or directory)
# Error in `processx::run(quarto_bin, args, echo = TRUE)`:
# ! System command 'quarto' failed
# ---
# Exit status: 1
# stdout & stderr: <printed>
# ---
# Type .Last.error to see the more details.
# And I would like to continuye as follows:
file.copy(
file.path(tmpdir, output_file),
file.path(".", output_file),
)
unlink(tmpdir)
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 ps_1.7.2 digest_0.6.30 later_1.3.0 R6_2.5.1 jsonlite_1.8.4
[7] evaluate_0.19 rlang_1.0.6 cli_3.6.0 rstudioapi_0.14 rmarkdown_2.18 tools_4.2.2
[13] yaml_2.3.6 xfun_0.36 fastmap_1.1.0 compiler_4.2.2 processx_3.8.0 htmltools_0.5.3
[19] knitr_1.41 quarto_1.2
> quarto::quarto_version()
[1] ‘1.2.313’
> pandoc::pandoc_version()
[1] ‘2.19.2’
The example runs on Ubuntu, but not on a Mac.
Checklist
- Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- Please format your issue so it is easier for us to read the bug report.
- Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- Please document the operating system you're running. If on Linux, please provide the specific distribution.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.