Standard output to report

Hey guys,
can anyone help me im trying to convert the standard output of my python script to a report is that possible ?
Thanks

Hi @Amanmohid,

You could use something like the following code in a Python Script to “redirect” the contents of stdout into a flow variable:

from contextlib import redirect_stdout
import io

fake_file = io.StringIO()
with redirect_stdout(fake_file):
    help(pow) # replace with command to execute

flow_variables['stdout'] = f.getvalue()

# Copy input to output
output_table = input_table.copy()

This snippet calls help(pow) and puts the content of output into a flow variable stdout that you can use for reporting.

Best,
Stefan