python: Start a New Python Session

pythonR Documentation

Start a New Python Session

Description

Start a new Python session with the specified options.

Ensure you have python installed.

Usage

python(options = NULL, command = NULL, module = NULL, file = NULL,
    args = NULL, chdir = FALSE, ..., name = windows.type, dir)

Arguments

options

character vector. The options to be provided for the new Python session.

command

character vector. The expressions to be run in the new Python session, provided to option -c cmd.

module

character string. The library module to run as a script, provided to option -m mod.

file

character string. The filename of the Python script to run in the new Python session, provided to option file.

args

Converted to character in a similar manner to withArgs.

chdir

logical; if TRUE and file is a pathname, the R working directory is temporarily changed to the directory containing file for evaluating.

...

further arguments passed to system().

name

the name or path of the Python executable to use. By default, it will use the Python executable found on Path. Specifying name can allow you to select a different version of Python to run, or select a version of Python tied to another application (for example: ArcGIS comes with a Python executable and the ArcPy module).

dir

character string; directory in which the Python executable is located.

Value

The value of system(). If intern = FALSE, it is returned invisibly.

Examples

## Not run: 
essentials::python(command = essentials::dedent(r"{
    print("Hello World!")
    print("An example python script...")
}"))

## End(Not run)

ArcadeAntics/essentials documentation built on Nov. 7, 2024, 4:33 p.m.