In blender 4.1 the console not shown the print result. I have test the code using these script in text editor but it doesn’t show the output text in console window.
import bpy
def execute(self, context):
test = “Hello, this is a test”
print(test)
Here I attached screenshot also. Please review and me know.
Thanks for your reply. but still it’s not print the output in console window. I don’t know why it’s happened. In older version blender there is an option to enable print console in addon preferences, but 4.1?
Print statements run from the Text Editor will print out in the System Console, not in Blender’s Python Console or Info view.
If you’re on Linux, you need to start Blender from the command prompt, if you’re on Windows you can click ‘Window > Toggle System Console’.
There are addons that will redirect the standard output from your system console back into the Blender console so that you don’t have to do one of the steps above, but AFAIK it was never a native feature of Blender, maybe you had Code Editor, or a similar addon installed in a previous version?
If you run code in the Python Console in Blender it will print statements back into that same console, but any prints run from the Text Editor will go, by default, only to your system console.
import sys
import bpy
class StdOutOverride:
def write(self, text):
sys.__stdout__.write(text)
if text != '\n':
for line in text.replace('\t', ' ').split('\n'):
for area in bpy.context.screen.areas:
if area.type == 'CONSOLE':
with bpy.context.temp_override(area=area):
bpy.ops.console.scrollback_append(text=line, type='OUTPUT')
sys.stdout = StdOutOverride()
print("This will be printed in Blender's Python console.")