devtools::build error when building vignette (my vignette has code that writes to drive

I am at a loss as to where to ask these type of question so if this is not the right forum I would appreciate pointers to the right place to ask.

I am trying to devtools::build() my package disk.frame to prepare it for CRAN submission. But the build fails at building the vignette (see error below). But I can build vignette fine on its own. How do I go about diagnosing this?

You can install my package using

remotes::install_github("xiaodaigh/disk.frame")

The only thing I can think of that makes my vignette atypical is that t writes to disk. My package is all about storing data on the hard drive so the vignette does a fair bit of that. So I was going to comment out the code that does the writing to disk and see if issues persist.

Pointers appreciated!

Error:

√ checking for file 'C:\Users\UserName\git\git\disk.frame/DESCRIPTION' ...

  • preparing 'disk.frame': (7m 7.5s)
    √ checking DESCRIPTION meta-information ...
  • cleaning src
  • installing the package to build vignettes
  • creating vignettes ...Warning in file(con, "r") : (1m 6.8s)
    cannot open file 'C:\Users\RTX2080\AppData\Local\Temp\Rtmpe6sJwU\xshell25e03c4478c9': Permission denied
    Error in file(con, "r") : cannot open the connection
    Execution halted
    Error in processx::run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), :
    System command error

Please post the code that's causing the error.

`devtools::build()`
[/quote]

causes the error. But to get there you need

* Start a RStudio Project with Version Control
* The version control URL should be https://github.com/xiaodaigh/disk.frame
* then `devtools::build()`

I meant which line in the vignette was causing a problem, but that was a long shot whether you'd be able to tell. The build message isn't very specific. But it makes me think of a common scenario with this error message: it's shown when the "file path" is actually a directory path.

This is probably something with the code in your package. None of the non-package code in the vignette seems to have a problem. But it can still help to figure out which call in the Rmd gives the error.

A process to find it:

  1. Insert this somewhere into a chunk in your Rmd:

    stop("Everything works up to here")
    
  2. Rebuild the package. Either the file error or the custom error will stop the process.

  3. If it was the file error, move the custom stop() one line higher. If it was the custom error, move it one line lower. (Or, to minimize the time and learn a neat algorithm, move it according the binary search algorithm.)

  4. When moving the custom stop() command by a single line changes which error stops the process, you've found the culprit line.

After that, you'll need to dig into your package's code.


Total guess

Many of the functions in R/disk.frame.r assume there are only files in the directory named in a disk.frame's "path" attribute. For example:

head.disk.frame <- function(df, n = 6L, ...) {
  stopifnot(is_ready(df))
  path1 <- attr(df,"path")
  cmds <- attr(df, "lazyfn")
  if(dir.exists(path1)) {
    path2 <- list.files(path1,full.names = T)[1]
    head(disk.frame:::play(fst::read.fst(path2, from = 1, to = n, as.data.table = T), cmds), n = n, ...)
  } else {
    head(disk.frame:::play(fst::read.fst(path1, from = 1, to = n, as.data.table = T), cmds), n = n, ...)
  }
}

What if path2 is a directory?

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.