Skip to content

Commit

Permalink
redirect output to file
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kalinowski committed Jan 2, 2025
1 parent 9766d73 commit 86c4af7
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions R/py_require.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ uv_binary <- function() {
if (file.exists(uv))
return(uv)


if(is_windows()) {

} else if (is_macos() || is_linux()) {
Expand Down Expand Up @@ -62,15 +61,15 @@ get_or_create_venv <- function(requirements = NULL, python_version = "3.10", exc
exclude_newer <- c("--exclude-newer", maybe_shQuote(exclude_newer))
}

# outfile <- tempfile(fileext = ".txt")
# on.exit(unlink(outfile), add = TRUE)
# input <- sprintf("
# import sys
# with open('%s', 'w') as f:
# print(sys.executable, file=f, flush=True)
#
# ", outfile)
input <- "import sys; print(sys.executable);"
outfile <- tempfile(fileext = ".txt")
on.exit(unlink(outfile), add = TRUE)
input <- sprintf("
import sys
with open('%s', 'w') as f:
print(sys.executable, file=f)
", outfile)
# input <- "import sys; print(sys.executable);"

result <- suppressWarnings(system2t(
uv_binary(),
Expand Down Expand Up @@ -109,8 +108,8 @@ get_or_create_venv <- function(requirements = NULL, python_version = "3.10", exc
stop(msg)
}

result
# readLines(outfile)
# result
readLines(outfile)
}

new_requirement_history_entry <- function(packages, python_version, action, env) {
Expand Down

0 comments on commit 86c4af7

Please sign in to comment.