run_python_script_with_args: Run a Python script with command-line arguments

View source: R/run_python_script_with_args.R

run_python_script_with_argsR Documentation

Run a Python script with command-line arguments

Description

Run a Python script with command-line arguments

Usage

run_python_script_with_args(
  python_script_path,
  args = c(),
  ormr_folder_name = get_default_ormr_folder_name(),
  python_version = get_default_python_version(),
  verbose = FALSE
)

Arguments

python_script_path

path to a Python script

args

arguments to a script, for example --help

ormr_folder_name

can be either python3 or the name of the folder where ormr installs all Python environments and packages.

python_version

the version of Python used. Use get_default_python_version to get the default Python version.

verbose

the verbosity of a function. Set to TRUE for more output. Use check_verbose to detect if this argument is valid.

Value

The output of the Python script

Author(s)

Richèl J.C. Bilderbeek

See Also

use run_python_script to run a Python script without command-line arguments

Examples

if (plinkr::is_on_ci()) {

  if (is_conda_installed()) {
    ormr_folder_name <- create_default_conda_env()
  } else {
    # Use local python
    ormr_folder_name <- "python3"
  }

  python_script_path <- system.file(
    "extdata", "show_args.py", package = "ormr"
  )
  run_python_script_with_args(
    ormr_folder_name = ormr_folder_name,
    python_script_path = python_script_path,
    args = c("Hello", "world")
  )
}

richelbilderbeek/ormr documentation built on May 23, 2022, 1:15 p.m.