2
$\begingroup$

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.

$\endgroup$

1 Answer 1

1
$\begingroup$

Check the output path just prior to calling bpy.ops.render.render. If it is pointing to a directory/folder that exists, try explicitly setting the layer and scene in the render function call. https://docs.blender.org/api/current/bpy.ops.render.html

enter image description here

$\endgroup$
1
  • $\begingroup$ I added an if statement to verify the path before it went to rendering and it all looked correct. It was probably good to add a check to that area anyways. I think I found the fix, though I haven't figured out what was wrong quite yet. I commented out this line: bpy.app.handlers.render_post.append(self.collectionStatus(collections[name], True)) The errors went away after I restarted blender and reloaded the addon. I guess I overlooked it earlier because I didn't do those last 2 steps so the errors remained. Thank you for your help and input! I also explicitly set the layer and scene:) $\endgroup$ Commented Jun 15, 2021 at 3:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .