Anaconda Enterprise: Documentation

# bokeh.application.handlers.code_runner

Provide a utility class `CodeRunner` for use by handlers that execute Python source code.

class `bokeh.application.handlers.code_runner.``CodeRunner`(source, path, argv)

  Compile and run Python source code.

  `new_module`()

    Make a fresh module to run in.

    Returns: | Module

  `run`(module, post_check)

    Execute the configured source code in a module and run any post checks.

    Parameters: | module (Module) – a module to execute the configured code in. post_check (callable) – a function that can raise an exception if expected post-conditions are not met after code execution.

  `error`

    If code execution fails, may contain a related error message.

  `error_detail`

    If code execution fails, may contain a traceback or other details.

  `failed`

    `True` if code execution failed

  `path`

    The path that new modules will be configured with.

  `source`

    The configured source code that will be executed when `run` is called.