Thanks, Nathan. On Apr 24, 2014, at 3:49 PM, Nathan Rusch <nathan_ru...@hotmail.com> wrote:
> A few things if you’re going to use threads: > > - I would recommend using `threading` instead of `thread`, as it’s more > approachable, and joining your thread if you want to block until the render > is done. I started by using threading, but then found a different example that used thread, so I went down that road, instead. I’ll read up on the differences... > > t = threading.Thread(target=self.renderWrites) > t.start() > t.join() > - You may want to consider moving the thread target function off of your > dialog class, and just passing the Write node(s) to it via the Thread object. I was wondering about that - if it was a good idea to combine the two or not… > - There’s no reason to use `nuke.executeInMainThreadWithResult` unless you > actually need to get a return value. When I was getting nothing at all to work, I wondered if there was some result that I needed to wait for (just poking around in the dark), so that’s why I switched it. Then, when things actually started to work better, I never switched it back… > - You need to pass the function and write node through > `nuke.executeInMainThread` separately. Otherwise, you’re just calling > `nuke.execute(writeNode)` and passing the result of that (which is probably > None) to `nuke.executeInMainThread`. > > nuke.executeInMainThread(nuke.execute, args=(writeNode,), > kwargs={'continueOnError':True}) I’ll have to let that settle into my brain for a bit. Still partly cloudy on a lot of how this is supposed to work… > > - A more idiomatic way to handle exceptions: > > try: > # Something > except Exception as e: > print 'ERROR: %s' % e # Or whatever you want to do > > I did have… except (TypeError, RuntimeError) as e: print “ERROR:”, e But, wondered if I could get more info by trying to catch anything and everything… It didn’t help me diagnose anything better, though. > Hope this helps. Yes, I’m sure it will, once I can digest it and try out some more examples. Thanks! Rich > > > -Nathan > > From: Richard Bobo > Sent: Thursday, April 24, 2014 12:22 PM > To: Nuke Python discussion > Subject: Re: [Nuke-python] Execute Write from Python panel > > Simon, > > Since I’ve never tried to do coding for a separate thread, I thought I’d give > it a try: > > http://pastebin.com/niEV5FPF > > My version has some of the very same elements as Mitja’s does. And, my code > works -- *most* of the time... > > ...However, sometimes it gets a... > "TypeError: expected callable object, NoneType found” > ...and sometimes it gets a… > “TypeError: ‘NoneType’ object is unscriptable” > ...and sometimes it gets a… > “RunTimeError: Cancelled” > > So, not too reliable!! (8^P > > If my co-worker Python-guru-friend was here today, I’m sure he could help me > debug the problem. Perhaps someone else here could help…? > > So close, yet, so far... > > Rich > > > Rich Bobo > Senior VFX Compositor > Armstrong White > Email: rich.b...@armstrong-white.com > http://armstrong-white.com/ > > Email: richb...@mac.com > Mobile: (248) 840-2665 > Web: http://richbobo.com/ > > "What you can do, or dream you can do, begin it; boldness has genius, power > and magic in it." > - Johann von Goethe > > > > > > On Apr 24, 2014, at 3:08 AM, Simon Björk <bjork.si...@gmail.com> wrote: > > Hi Mitja, > > thanks for the reply. I tested you code, but unfortunately I still get the > "I'm already executing something else" error. Does it work for you? > > Best regards, > Simon > > > 2014-04-24 8:19 GMT+02:00 Mtja Müller-Jend <filmk...@gmx.de>: > Hi Simon, > > try to use threading to execute the node: http://pastebin.com/06azNCzx > > Cheerz, > > Mitja > > Am 4/23/2014 11:54 PM, schrieb Simon Björk: > I'm trying to execute a Write node from a Python panel, but I'm not having > any luck. As I try to exectute the render I get a RuntimeError: I'm already > executing something else. > > One solution would be to use a Nuke panel instead, but I would really need a > Python panel for this script. See short example script here: > http://pastebin.com/NzStQNhk. > > I would really appriciate some help on this. > > Best regards, > Simon > > > _______________________________________________ > 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 > > > _______________________________________________ > 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 > > > _______________________________________________ > 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 > > > _______________________________________________ > 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 > _______________________________________________ > 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
_______________________________________________ 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