.PythonInit {RSPython}R Documentation

Initialize the Python interpreter.

Description

These functions allow one to initializes the Python engine and creates an interpreter and also to discard it and its contents. The .PythonInit function must be called before invoking a Python function or method. One can start, stop and restart the Python interpreter any number of times.

Usage

.PythonInit(path=NULL, merge=T, warn = FALSE, force=TRUE)
.PythonTerminate()

Arguments

path if specified, this should be a string specifying the directories in which to find Python modules. The directory names should be separated by the appropriate directory separator (":" on Unix). If this is missing, the current value fo the PYTHONPATH environment variable is used.
merge a logical value indicating whether the basic elements needed to locate the Python modules used to implement this package should be appended to the value of the system variable PYTHONPATH
warn if TRUE, issue a warning about the implicit initialization
force if FALSE and the Python interpreter has already been initialized, we just issue a warning and return. However, if this is TRUE, we attempt to perform another initialization.

Details

.PythonInit passes its arguments to .PythonPath to determine the appropriate value for the PYTHONPATH environment variable. It then uses the returned value to set this environment variable and then initializes the python interpreter.

Value

NULL or an error occurs.

Note

Very bad things will happen if you stop the interpreter and then access a Python object, function, method, etc. Python will terminate.

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/RSPython, http://www.python.org

See Also

.PythonPath

Examples

## Not run: 
  .PythonInit()
## End(Not run)

[Package RSPython Index]