Skip to content

Commit

Permalink
Better handle silent errors
Browse files Browse the repository at this point in the history
closes:#1674

return from `system2()` can be
a length!=1 character
  • Loading branch information
t-kalinowski committed Sep 23, 2024
1 parent 8a38c9a commit 6974279
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,11 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
# https://github.com/rstudio/reticulate/issues/1325
get_platform <- function(python) {
tryCatch({
system2(python,
args = c("-c", shQuote("import sys; print(sys.platform)")),
stdout = TRUE, stderr = FALSE)
plat <- system2(python,
args = c("-c", shQuote("import sys; print(sys.platform)")),
stdout = TRUE, stderr = FALSE
)
if (rlang::is_string(plat)) plat else ""
}, warning = function(w) "", error = function(e) "")
}
python_sys_platforms <- vapply(python_versions, get_platform, "")
Expand Down

0 comments on commit 6974279

Please sign in to comment.