pithon.load: pithon.load

Description Usage Arguments Details Value Examples

View source: R/pithon.load.R

Description

Executes Python code.

Usage

1
  pithon.load( file, get.exception = TRUE, instance.name="" )

Arguments

file

a file containing Python code to be executed

get.exception

logical value indicating whether to check or not for exceptions in Python

instance.name

if specified, use the Python instance with this name

Details

This function runs Python code contained in a file. Typically, this file would contain functions to be called via pithon.call or other functions in this package.

The get.exception option allows the user to disregard Python exceptions in cases where safe calls to avoid the overhead of checking for them.

Value

None. If the code produces some output, it is up to the caller to go and fetch if from Python using function pithon.get.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
if (pithon.available())
{
	a <- 1:4
	b <- 5:8

	# this file contains the definition of function concat
	pithon.load( system.file( "concat.py", package = "rPython" ) )
	pithon.call( "concat", a, b)

} else {
	print("Unable to execute python")
}

rPithon documentation built on May 2, 2019, 5:51 p.m.