I don’t know if this is a bug or a “feature” so I thought I would post it here and see what you think!?
Basically if you create a script and have it execute on a frame change by using either the frame_change_pre or frame_change_post handler you will get predictable and repeatable results ie the script is run once per frame.
If however you enable motion-blur in Cycles while rendering, the script will be run multiple times per frame. This is because cycles jumps the frame counter back and forth behind the scenes to generate the motion-blur, screwing up the frame change handler.
I don’t know if this would be considered a bug in Cycles or the Python API because technically both are doing what they should be doing, its just that they are not working together in the expected way.
I just spent about three days looking for bugs in my scripts before I realized it was due to the frame_change_pre handler being called more than it should, hopefully this post will prevent someone else from doing the same