mercredi 3 mars 2021

R CMD check fails with ubuntu when trying to download file, but function works within R

I am writing an R package and one of its functions download and unzips a file from a link (it is not exported to the user, though):

download_f <- function(download_dir) {
  utils::download.file(
    url = "https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php",
    destfile = file.path(download_dir, "fines.rar"),
    mode = 'wb',
    method = 'libcurl'
  )

  utils::unzip(
    zipfile = file.path(download_dir, "fines.rar"),
    exdir = file.path(download_dir)
  )
}

This function works fine with me when I run it within some other function to compile an example in a vignette.

However, with R CMD check in github action, it fails consistently on ubuntu 16.04, release and devel. It [says][1]:

Error: Error: processing vignette 'IBAMA.Rmd' failed with diagnostics:
cannot open URL 'https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php'
--- failed re-building ‘IBAMA.Rmd’

SUMMARY: processing the following file failed:
  ‘IBAMA.Rmd’

Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.

When I run devtools::check() it never finishes running it, staying in "creating vignettes" forever. I don't know if these problems are related though because there are other vignettes on the package.

I pass the R CMD checks with mac os and windows. I've tried switching the "mode" and "method" arguments on utils::download.file, but to no avail.

Any suggestions? [1]: https://github.com/datazoompuc/datazoom.amazonia/pull/16/checks?check_run_id=2026865974

Aucun commentaire:

Enregistrer un commentaire