How can I get Blender's stdout?

I’m trying to code an add-on to better display console errors (game engine errors, for example), but I need to get the Blender stdout into a string. How can I do this?

Already tried to change the sys.stdout and some other stuff that I found on google. No success.

This should be enough in python:

print( "whatever you want to print")
var = 42
print("'var' has a value of ", var)

Which Platform? Print should do it, if not look into logger module

Hey, guys, thanks for the support. Actually I wasn’t trying to print in the console, I was trying to GET the console output. With a few more attempnts with sys.stdout and sys.stderr, I got this to work.

Here is the final addon:

Thanks! :slight_smile:

1 Like