Thanks Nathan

Jack Simpson
Junior TD

eyeball

Mobile 978-413-5053
Office 212-431-5324
Fax 212-431-6793

http://www.eyeballnyc.com

________________________________________
From: [email protected] 
[[email protected]] on behalf of 
[email protected] 
[[email protected]]
Sent: Thursday, June 21, 2012 7:00 AM
To: [email protected]
Subject: Nuke-python Digest, Vol 53, Issue 21

Send Nuke-python mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Nuke-python digest..."


Today's Topics:

   1. using threading.Timer() to check if files exist (Jack Simpson)
   2. Re: using threading.Timer() to check if files exist (Nathan Rusch)
   3. Gizmos disconnects inputs upon launch (Simon Bj?rk)


----------------------------------------------------------------------

Message: 1
Date: Wed, 20 Jun 2012 22:13:00 +0000
From: Jack Simpson <[email protected]>
Subject: [Nuke-python] using threading.Timer() to check if files exist
To: "[email protected]"
        <[email protected]>
Message-ID:
        
<7D5033A824DAB344850AB26EA3C49643F3DA95@mbx024-e1-nj-8.exch024.domain.local>

Content-Type: text/plain; charset="iso-8859-1"

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120620/3c34a825/attachment.html

------------------------------

Message: 2
Date: Wed, 20 Jun 2012 15:18:01 -0700
From: Nathan Rusch <[email protected]>
Subject: Re: [Nuke-python] using threading.Timer() to check if files
        exist
To: "Nuke Python discussion" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Are you calling Nuke-specific code when it crashes? If so, you probably need to 
call it using nuke.executeInMainThread(). Give that a try, and if it doesn’t 
work, can you post an example of the types of calls you’re making when it 
crashes?

-Nathan



From: Jack Simpson
Sent: Wednesday, June 20, 2012 3:13 PM
To: [email protected]
Subject: [Nuke-python] using threading.Timer() to check if files exist

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
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120620/fdc4d8cb/attachment-0001.htm

------------------------------

Message: 3
Date: Thu, 21 Jun 2012 09:43:09 +0200
From: Simon Bj?rk <[email protected]>
Subject: [Nuke-python] Gizmos disconnects inputs upon launch
To: Nuke Python discussion <[email protected]>
Message-ID:
        <CAMwgG08xs_xzaDk5pyihzGO=criGHwbs4x2-W6CnC=virwx...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

When I launch my script some of my custom gizmos loose their inputs and I
have to manually connect them again. Anyone seen this? They are just simple
gizmos with a few knobChanged callbacks. Using Nuke 6.3v7 on Linux.

Best regards,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120621/ee2d31b4/attachment-0001.htm

------------------------------

_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

End of Nuke-python Digest, Vol 53, Issue 21
*******************************************
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to