# python.begin

Starts a python code snippet

Usage

    python.begin [-n] [-q] [(<python_context>[,<arg0>[,<arg1>[...]]])]
    <python code>
    python.end

Description

Indicates the beginning of a snippet of python code. The whole code part between python.begin and python.end is executed in a python interpreter. If python.end is omitted then it is implicitly assumed that the code from python.begin to the end of the command buffer is python.
Each python code execution is bound to a python context (that is in fact a particular instance of a python interpreter). If <python_context> is not specified or it is an empty string then temporary python interpreter is created and destroyed just after the code snippet has terminated execution. If <python_context> is specified then a python interpreter keyed to that context is used: if it was already existing then it is reused otherwise it is created. Any <python_context> is persistent: it mantains the function declarations and python variable states until explicitly destroyed with python.destroy (or the pythoncore module is forcibly unloaded).
The <arg0>,<arg1>,... arguments, if present, are passed to the python code snippet in the aArgs list (accessible as aArgs[0],aArgs[1]...).
The return value of the python code is propagated to the current context (just like setreturn was called on it) unless the -n switch is used.
The -q switch prevents from the command from printing any warning.
See the python scripting documentation for more information.

Switches

-q | --quiet
Prevents the command from printing any warnings.
-n | --no-return
Prevents the python script return value to be propagated to the current context.
-f | --fail-on-error
Treat python errors as KVS errors and abort execution of the current script. Incompatible with -q

Syntax Specification

    python.begin [-n] [-q] [(<python_context>[,<arg0>[,<arg1>[...]]])]
    <python code>
    python.end

Examples

        python.begin
        kvirc.eval("echo \"Hello World from python!\"");
        python.end

Index, Commands

KVIrc 4.2.0.6190 Documentation
Generated by portbuild at Mon Aug 12 12:09:14 2013