I am trying to read the source code to understand how pyRevit works.
Looking at the PyRevitOutputWindow class in pyrevitlib > output > init.py I see the functions to print_html(html_str) is using python’s built-in print function. Where is this function being redirected to execute in the output window?
def _setup_output():
# create output window and assign handle
out_window = runtime.types.ScriptConsole()
runtime_info = sessioninfo.get_runtime_info()
out_window.AppVersion = '{}:{}:{}'.format(
runtime_info.pyrevit_version,
int(runtime_info.engine_version),
runtime_info.host_version
)
# create output stream and set stdout to it
# we're not opening the output window here.
# The output stream will open the window if anything is being printed.
outstr = runtime.types.ScriptIO(out_window)
sys.stdout = outstr
# sys.stderr = outstr
stdout_hndlr = logger.get_stdout_hndlr()
stdout_hndlr.stream = outstr
return out_window