pkgnet icon indicating copy to clipboard operation
pkgnet copied to clipboard

CreatePackageReport() fails to generate report

Open jameslamb opened this issue 5 years ago • 5 comments

I'm unsure of the exact issue, but the following code

pkg_name <- YOUR_PACKAGE_NAME
CreatePackageReport(
    pkg_name
    , report_path = file.path(getwd(), "report.html")
)

fails to generate a report at all and returns this in the logs

Error in readLines(con, warn = FALSE) : cannot open the connection
Calls: <Anonymous> ... base -> extract_preserve_chunks -> read_utf8 -> readLines
In addition: Warning message:
In readLines(con, warn = FALSE) :
  cannot open file 'package_report.utf8.md': No such file or directory
Execution halted
pandoc: package_report.utf8.md: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1

I have found that this error is transient, so might be hard to figure out.

I've observed this for the following packages:

  • AICcmodavg
  • ape
  • arulesViz
  • base64
  • CALIBERrfimpute
  • circlize
  • corrgram
  • corrplot
  • desc
  • dbplyr
  • DoE.base
  • emulator
  • EpiModel
  • futile.logger
  • gamlss.data
  • geoR
  • geosphere
  • heplots
  • kinship2
  • lambda.r
  • LaplacesDemon
  • magic
  • mirt
  • nnet
  • ordinal
  • party
  • plyr
  • qrng
  • quantreg
  • R.oo
  • Rcmdr
  • reticulate
  • rpart.plot
  • RUnit
  • slam
  • speedglm
  • survival
  • svd
  • tibble
  • tools
  • translations
  • trimcluster
  • tweedie
  • xfun
  • xopen
  • yaml

discovered via the code in #252

jameslamb avatar Oct 22 '19 03:10 jameslamb

Removed the Hacktoberfest label from this one since the issue is so difficult and transient and possibly just related to bugs in my code in a draft PR (#252 )

jameslamb avatar Oct 22 '19 04:10 jameslamb

This issue happens when knitr / rmarkdown builds more than one report from the same template at once. By default rmarkdown::render will drop intermediary files in the directory of the report template. When you render more than one report from the same template it will end up deleting or overwriting these intermediary files.

When using rmarkdown::render the solution is to specify a unique intermediates_dir for each report.

rekado avatar May 22 '21 21:05 rekado

Thanks very much for that information? Are you interested in proposing a pull request?

jameslamb avatar May 22 '21 22:05 jameslamb

No thanks. I haven't even looked at your code yet :) I just happened to stumble upon the exact same error message in a project I was working on and thought I'd share what I found.

rekado avatar May 23 '21 07:05 rekado

no problem, thanks for the help!

jameslamb avatar May 23 '21 17:05 jameslamb