All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyInterpreter.h File Reference

Python runtime utilities. More...

+ Include dependency graph for pyInterpreter.h:

Go to the source code of this file.

Functions

TF_API void TfPyInitialize ()
 Starts up the python runtime. More...
 
TF_API int TfPyRunSimpleString (const std::string &cmd)
 Runs the given string using PyRun_SimpleString(). More...
 
TF_API boost::python::handle TfPyRunString (const std::string &cmd, int start, boost::python::object const &globals=boost::python::object(), boost::python::object const &locals=boost::python::object())
 Runs the given string using PyRun_String(). More...
 
TF_API boost::python::handle TfPyRunFile (const std::string &filename, int start, boost::python::object const &globals=boost::python::object(), boost::python::object const &locals=boost::python::object())
 Runs the given file using PyRun_File(). More...
 
TF_API std::string TfPyGetModulePath (const std::string &moduleName)
 Returns the disk path to the given module as an NSString. More...
 

Detailed Description

Python runtime utilities.

Definition in file pyInterpreter.h.

Function Documentation

TF_API std::string TfPyGetModulePath ( const std::string &  moduleName)

Returns the disk path to the given module as an NSString.

Starts the interpreter if necessary. Deals with necessary thread state setup.

TF_API void TfPyInitialize ( )

Starts up the python runtime.

IMPORTANT: The GIL will NOT be held when this returns. (If Python is already initialized, the GIL will be unchanged)

The program name and arguments are set automatically. sys.argv has no arguments other than an argv[0] matching the program name.

TF_API boost::python::handle TfPyRunFile ( const std::string &  filename,
int  start,
boost::python::object const &  globals = boost::python::object(),
boost::python::object const &  locals = boost::python::object() 
)

Runs the given file using PyRun_File().

start is Py_eval_input, Py_single_input or Py_file_input. globals and locals can be dictionaries to use when evaluating the string in python. Defaults to reusing globals from main module. If only the globals are provided, they will also be used as locals.

Starts the interpreter if necessary. Deals with necessary thread state setup.

TF_API int TfPyRunSimpleString ( const std::string &  cmd)

Runs the given string using PyRun_SimpleString().

Starts the interpreter if necessary. Deals with necessary thread state setup.

TF_API boost::python::handle TfPyRunString ( const std::string &  cmd,
int  start,
boost::python::object const &  globals = boost::python::object(),
boost::python::object const &  locals = boost::python::object() 
)

Runs the given string using PyRun_String().

start is Py_eval_input, Py_single_input or Py_file_input. globals and locals can be dictionaries to use when evaluating the string in python. Defaults to reusing globals from main module. If only the globals are provided, they will also be used as locals.

Starts the interpreter if necessary. Deals with necessary thread state setup.