Skip to content

Commit

Permalink
bugfix for no detectable python config
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Aug 17, 2023
1 parent d652bfd commit 637d3aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/find_python.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ find_python <- function(envname = NULL,

# find newest python installation with rosetta installed
x <- try(reticulate::py_discover_config("rosetta"))
if (length(x$python_versions) > 0) {
if (!is.null(x$python_versions)) {
xxx <- lapply(x$python_versions, function(x) {
y <- gsub("Python ", "", system(paste(shQuote(x), "--version"), intern = TRUE, ignore.stdout = TRUE, ignore.stderr = TRUE))
if (length(y) == 0) return("0")
Expand All @@ -83,7 +83,7 @@ find_python <- function(envname = NULL,
# otherwise find newest python installation
if (is.null(res) || inherits(res, 'try-error')) {
x <- try(reticulate::py_discover_config())
if (length(x$python_versions) > 0) {
if (!is.null(x$python_versions)) {
xxx <- lapply(x$python_versions, function(x) {
y <- gsub("Python ", "", system(paste(shQuote(x), "--version"), intern = TRUE, ignore.stdout = TRUE, ignore.stderr = TRUE, show.output.on.console = FALSE))
if (length(y) == 0) return("0")
Expand Down

0 comments on commit 637d3aa

Please sign in to comment.