{ } Raw JSON

bundles / jupyter_client latest / jupyter_client / client / KernelClient / execute

function

jupyter_client.client:KernelClient.execute

source: /jupyter_client/client.py:607

Signature

def execute(self, code: str, silent: bool = False, store_history: bool = True, user_expressions: t.Dict[str, t.Any] | None = None, allow_stdin: bool | None = None, stop_on_error: bool = True) → str

Summary

Execute code in the kernel.

Parameters

code : str

A string of code in the kernel's language.

silent : bool, optional (default False)

If set, the kernel will execute the code as quietly possible, and will force store_history to be False.

store_history : bool, optional (default True)

If set, the kernel will store command history. This is forced to be False if silent is True.

user_expressions : dict, optional

A dict mapping names to expressions to be evaluated in the user's dict. The expression values are returned as strings formatted using repr.

allow_stdin : bool, optional (default self.allow_stdin)

Flag for whether the kernel can send stdin requests to frontends.

Some frontends (e.g. the Notebook) do not support stdin requests. If raw_input is called from code executed from such a frontend, a StdinNotImplementedError will be raised.

stop_on_error: bool, optional (default True)

Flag whether to abort the execution queue, if an exception is encountered.

Returns

: The msg_id of the message sent.

Aliases

  • jupyter_client.KernelClient.execute