const
(const)
January 7, 2014, 2:10pm
1
I seek ways of logging information in Blender, instead of using the standard print I would like to do it inside Blender.
What I would like to have is something like this: http://nicholasbishop.net/?p=544
But it seems that it’s very difficult and involves C native code.
Otherwise text editor would work just fine, but there must be a way to append text into a file and then update/redraw the editor type to see the changes.
I have been looking for this quite a few days now, If you know something about this let me know. Thanks.
I seek ways of logging information in Blender, instead of using the standard print I would like to do it inside Blender.
What I would like to have is something like this: http://nicholasbishop.net/?p=544
But it seems that it’s very difficult and involves C native code.
Otherwise text editor would work just fine, but there must be a way to append text into a file and then update/redraw the editor type to see the changes.
I have been looking for this quite a few days now, If you know something about this let me know. Thanks.
log=bpy.data.texts.new('log')
log.clear() #flush
log.write("your text
")
or use this operator with an overriden context to write to the interactive console
import bpy
C=bpy.context
for area in C.screen.areas:
if area.type=='CONSOLE':
break
space=area.spaces[0]
region=area.regions[1]
override={
'window':C.window,
'screen':C.screen,
'area':area,
'region':region,
'space_data':space
}
bpy.ops.console.scrollback_append(
override,
text="FROM SCRIPT"
)
import logging
logging.basicConfig(filename=‘c:\ mp\python.log’, format=’%(message)s’, level=logging.INFO)
logging.info('data erg:
’ + str(47))