I have a script that goes through a list of collections and renders each collection with a specific camera and compositor nodes. Everything seems to be working as expected except I receive this error in the console: "TypeError: 'NoneType' object is not callable." The rendered images are being saved and look as expected, but this error is present each time the script is used.
def Render(self, activeCollections, collections, outputPath, scene, state):
for renderCol in activeCollections:
name = renderCol.name
#enable single collection
self.collectionStatus(collections[name], False)
#get camera in active collection, set to active.
bpy.context.scene.camera = bpy.data.objects[str("%s_Render_Camera" % name)]
#create filename from collection name
outputFilename = "ui_icon_%s_%s" % (name, state)
#render
scene.render.filepath = '%s' % (os.path.join(outputPath, outputFilename))
bpy.ops.render.render(write_still=True)
bpy.app.handlers.render_post.append(self.collectionStatus(collections[name], True))
for i in activeCollections:
self.collectionStatus(collections[i.name], False)
I have run through each variable to check that there isn't a NoneType. The TypeError also seems to stack each time I run the script. After running the script a few times my console starts to look like this:
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
TypeError: 'NoneType' object is not callable.
etc...
The TypeError only seems to occur during this line bpy.ops.render.render(write_still=True)
.
If I comment this line out, there are no type errors, but of course, there are no renders either. Does anyone know what could be causing this? I've checked my blender scene file for missing...everything. Materials, duplicate named meshes, duplicate nodes, etc. I'm kind of stumped here.