R/py.R

Defines functions pycall pyscript

# 
# Author: Wush Wu
# Copyright (c) Bridgewell Inc.
#  

#'@export
pyscript <- function(script) {
  stopifnot(class(script) == "character")
  .Call("RembedPy__pyscript", script[1])
}

#'Call a python function with parameters
#'
#'Only passed without name
#'
#'@export
pycall <- function(fun_name, ..., module_name = "__main__") {
	argv <- check_argv(list(...))
 	new("py-ptr", {
     ptr <- .Call("RembedPy__pycall", module_name, fun_name, argv$list, argv$dict)
     if (is.null(ptr)) stop("pycall failed")
     ptr
 	})}
wush978/RembedPy documentation built on May 28, 2017, 6:39 a.m.