Python Ploty with IIS

I am generating image with Python Plotly and getting data from web app via process standard output. I am able to get the result back at debug mode and after releasing to the server with IIS, I haven’t got result back and doesn’t seems to running that python file.
Can I get some suggestion please? Thanks.

img_bytes = fig.to_image(format="png")
img_base64_string = base64.encodebytes(img_bytes).decode()
json_obj = {'image_string': img_base64_string}
txt = json.dumps(json_obj)    
print(txt, file=sys_output)