I wonder if it is currently possible to print or send messages to the Report window in the Info view? this would be quite useful sometimes.
3 Answers
We can always use an operator's report method. Running the following operator:
class RENDER_OT_test(bpy.types.Operator):
bl_idname = 'render.oha_test'
bl_label = 'Test'
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
self.report({'INFO'}, 'Printing report to Info window.')
return {'FINISHED'}
prints this in the Info window:

The color depends on the type enum: INFO gets green, WARNING light red, and ERROR dark red. I don't see reference to any direct output to Info window, other than this method.
I needed to display a notification message when running a script in the Text Editor by hitting the 'Run Script' button. For exactly this purpose I have found a hack that works, even if this is not the preferred way :)
import bpy
def oops(self, context):
self.layout.label(text="You have done something you shouldn't do!")
bpy.context.window_manager.popup_menu(oops, title="Error", icon='ERROR')
- 12,613
- 4
- 50
- 93
- 7,392
- 2
- 25
- 62
-
with newer version of blender 2.9x use self.layout.label(text="You have done something you shouldn't do!") – cscholl Feb 15 '21 at 10:48
This should be the code: to get popup in mouse event use ERROR instead INFO. see report -'INFO' is lower and 'ERROR_OUT_OF_MEMORY' is highest level of error type.
def yourfunction(context):
whatever the function
class RENDER_OT_test(bpy.types.Operator):
bl_idname = 'render.oha_test'
bl_label = 'Test'
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
try:
yourfunction(context)
return {'FINISHED'}
except:
self.report({'INFO'}, 'Printing report to Info window.')
return {'CANCELLED'}
- 262
- 8
-
3
-
The accepted answer doesn't work without try condition in Blender 2.79 and the return statement and code blocks are clarified here. – Fahad Hasan Pathik Nov 10 '17 at 22:54

bpy.ops.render.oha_test()i get `Undefined Type: Printing report to Info window.{'FINISHED'}` and there is no printing to the report window..
– zeffii Jun 08 '13 at 11:33INFO,WARNINGorERROR, the message is prefixed accordingly (e.g. "Info: ..."). But if we addDEBUG, the prefix turns to "Undefined Type: ...". Maybe we're dealing with a little quirk (bug?) in the C function related to flag-reading. Gotta read the source to make sure, but I don't think it's an error. (andreportdoesn't output to report area if executed on a Python interpreter area) – Adhi Jun 08 '13 at 11:57DEBUGis the lowest andERRORis the highest. – brecht Jun 08 '13 at 12:01DEBUGoutputs nothing, either in shell, Info's report area or header. – Adhi Jun 08 '13 at 12:07blenkernel/intern/report.cusesswitchinstead of bitwise ops. That explains... – Adhi Jun 08 '13 at 12:23DEBUGand other type suppresses output to Info area's header, though, which led me to think it has some use :) I concede that it's probably unintended. – Adhi Jun 08 '13 at 16:59`import bpy
class RENDER_OT_test(bpy.types.Operator): bl_idname = 'render.oha1_test' bl_label = 'Test' bl_options = {'REGISTER', 'UNDO'} def execute(self, context): self.report({'INFO'}, 'Printing report to Info window.') return {'FINISHED'} bpy.utils.register_class(RENDER_OT_test)`
test call to the newly defined operator
– user918 Jul 09 '13 at 04:13bpy.ops.render.oha1_test()bpy.ops.render.oha1_testin Python console or as Test in spacebar-menu. Works for me. – Adhi Jul 09 '13 at 05:16