aws.s3
aws.s3 copied to clipboard
object_exists(object, bucket, ...) show warning when FALSE
Hi there-
When object_exists()
returns FALSE
a warning: Client error: (404) Not Found
How can we disable this specific warning please ?
## load package
## [Package aws.s3 version 0.3.13 Index]
library("aws.s3")
## code goes here
object_exists(
object = key.dir,
bucket = bucket,
check_region = FALSE,
key = aws.key,
secret = aws.secret
)
## session info for your system
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Amazon Linux 2
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0 yaml_2.2.0 packrat_0.4.9-3
Experiencing the same issue. Any update on this?
Here is a way around that:
Use the suppressMessages
wrapper around the call
suppressMessages(object_exists("object_path"))
or around lapply call, like this:
fnamesS3 <- c("object1_path", "object2_path", "object3_path")
suppressMessages(ll<-sapply(fnamesS3, object_exists))
Wrapping it with suppressMessages definitely work but ideally the warning is only shown when verbose = T. Otherwise, it's a little bit of a nuisance since it should only return T/F anyway. Thanks!
Any update on this issue?