#include <BALL/PYTHON/pyKernel.h>
|
using | KeyValArgs = std::map< std::string, std::string > |
|
Definition at line 14 of file pyKernel.h.
◆ KeyValArgs
◆ PyKernel()
BALL::PyKernel::PyKernel |
( |
| ) |
|
|
default |
◆ ~PyKernel()
virtual BALL::PyKernel::~PyKernel |
( |
| ) |
|
|
virtualdefault |
◆ execute()
virtual bool BALL::PyKernel::execute |
( |
const std::string & |
module, |
|
|
const std::string & |
func, |
|
|
const KeyValArgs & |
args |
|
) |
| |
|
pure virtual |
Calls a single function from a given module.
- Parameters
-
module | a Python module |
func | a function from the given module |
args | function arguments as key-value pairs |
- Returns
- true if the execution succeeded
Implemented in BALL::PyCAPIKernel.
◆ getErrorMessage()
virtual std::string BALL::PyKernel::getErrorMessage |
( |
| ) |
const |
|
pure virtual |
Returns the most recent error message emitted by the Python interpreter.
- Returns
- most recent error message
Implemented in BALL::PyCAPIKernel.
◆ isStarted()
virtual bool BALL::PyKernel::isStarted |
( |
| ) |
const |
|
pure virtual |
Checks whether the kernel is started.
- Returns
- true if kernel is started, else otherwise
Implemented in BALL::PyCAPIKernel.
◆ loadScriptDir()
virtual void BALL::PyKernel::loadScriptDir |
( |
| ) |
|
|
protectedvirtual |
Appends the 'python' directory in the BALL data path to sys.path
. This is where additional BALL-specific Python scripts would be located.
This function should be called by every kernel implementation on initialization!
◆ run()
virtual std::pair<bool, std::string> BALL::PyKernel::run |
( |
std::string |
str | ) |
|
|
pure virtual |
Executes a single Python string.
- Parameters
-
str | correctly indented Python string |
- Returns
- The first value indicated whether the execution succeeded. The second value is the output generated by the execution, if any.
Implemented in BALL::PyCAPIKernel.
◆ runFile()
Executes a single Python file.
- Parameters
-
- Returns
- true if the execution succeeded
- Deprecated:
- Use Jupyter notebook plugin instead
Implemented in BALL::PyCAPIKernel.