proc_python: Run a Python process

Description Usage Arguments Value Examples

Description

This function returns a list of functions to start/run/stop a Python process. The code is sent to Python via a socket connection, and the results are written back in another socket connection.

Usage

1
proc_python(port = 6011)

Arguments

port

A TCP port number

Value

A list of functions start(), exec(), running() (check if the process has been running), and stop().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
py = proc_python()
py$start()
py$exec("1+1")
py$exec("import numpy as np", "a=np.arange(5)", "a+5")  # return nothing
py$exec("print a+5")  # [5 6 7 8 9]
py$running()  # should be TRUE
py$stop()

## End(Not run)

yihui/runr documentation built on May 4, 2019, 4:26 p.m.