I'm looking to write a script to print a message when the render is done.

if bpy.app.handlers.render_complete == True:
    print("\a") # beep
    print("Render complete!")

only that doesn't work when the render is finished.

I tried wrapping it in app handler but I just got errors

import os
import bpy
from pycl import print
from bpy.app.handlers import persistent

# clear the screen


def my_handler(scene):
    print("\a") # beep
    print("Render done!!")


Traceback (most recent call last): File "\Text", line 15, in my_handler File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\pyc l.py", line 33, in print console_print(*args, **kwargs) # to Python Console File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\pyc l.py", line 20, in console_print for a in context.screen.areas: AttributeError: 'NoneType' object has no attribute 'areas'

I've had a look at this post. Without a greater understanding of app handler, I'm not sure where I'm going wrong.

I've restarted Blender a couple of times and now have found that it was

from pycl import print

causing the error, simply removing it or commenting it out the script works fine.

  • $\begingroup$ Looking at the error message it looks like your problem isn't really tied to the handler, but rather what you're doing when the render finishes. It seems you're trying to access a context which is not valid anymore. Could you post the rest of your code relevant to that ? $\endgroup$
    – Gorgious
    Commented Nov 23, 2022 at 15:54
  • 1
    $\begingroup$ @Gorgious I've taken a fresh look at it, turns out I was printing using pycl. Printing to the console, instead of Blender console and the code works fine. $\endgroup$
    – Ghoul Fool
    Commented Nov 23, 2022 at 16:45


You must log in to answer this question.

Browse other questions tagged .