Hi,

I'm having a problem with the threading.Timer() function.

I've written a little class which runs after I've submitted a job to the farm.
It checks the directory of the write node(s) to see if the file exists / has 
been rendered.
I run the timer to check it every 20 seconds until it completes. It check 
nicely every 20 seconds and gives me correct feedback.
However, when it does complete, Nuke crashes and I get an error in the terminal 
which includes:

"QObject::setParent" Cannot set parent, new parent is in a different thread"
"QObject::startTimer: QTimer can only be used with threads started with QThread
"Cannot queue arguments of type 'Animation_Event'"
"Make sure 'Animation_Event' is registered using qRegisterMetaType()"

These errors and crash only occur when the files have finished rendering and I 
try to pass another function. Even if I use a try-except.

Here's a simplified snippet of my code:

class PostRender:
    def __init__(self, writenodes, args):
        get args
        print some feedback
        self.completed = []

    def exists(self):
        for w in writes:
            if w in self.completed:
                continue
            if all(framerange in w exists):
                print w + ' node has finished rendering'
                self.completed.append(w)
            else:
                print w + ' node is still rendering'
        self.wait()

    def wait(self):
        if len(writenodes) == len(self.completed):
            #Crashes here and produces terminal errors
            try:
                print "Rendering complete"
                do another function()
            except:
                return
        else:
            myTimer = threading.Timer(15, self.exists())
            myTimer.start()



I'm new-ish to Python and have never used the threading module before.

I would be so grateful for any help / light-shedding on this topic.

Thanks,

Jack

Nuke 6.3v3
Windows 7 64bit
16GB RAM
16Core CPU
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to