Thanks Ean!

Working well, except that the thread does not finish execution before Nuke closes. Is there a way to get that popup window back again which tells you that there are active background threads running?

Thanks,


Nhat




On 8/12/2011 9:48 AM, Ean Carr wrote:
Hey,

In your __init__, set

self.daemon = True

Cheers,
-E

On Fri, Aug 12, 2011 at 2:54 AM, Nhatphong Tran <[email protected] <mailto:[email protected]>> wrote:

    Hi!

    I created a separate thread which writes some arbitrary string to
    a textfile each 10th of a second in a 60 seconds loop. When I quit
    Nuke while that thread is running, a popup window notifying me of
    active background scripts shows up (which is fine) and without
    doing anything nuke crashes. Does anyone have a clue why that happens?

    This what I do

    ### HEADER
    import threading
    import time
    import sys

    ### WORK-HORSE
    def writeTest():
       f = open('/san/rnd/RND024521/test.txt', 'w')
       jj=0
       for j in range(0,600):
           jj=jj+0.1
           s = ("waiting " + str(jj) +"s\n")
           print s
           f.write(s)
           time.sleep(0.1)

       f.close()


    class WriteTestThreaded( threading.Thread ):
       ### THREAD OBJECT INITIALIZATION
       def __init__( self):
               threading.Thread.__init__( self )

       ### RUN IMPLEMENTATION
       def run( self ):
               nuke.executeInMainThread(writeTest())

    WriteTestThreaded().start()


    Thanks a lot!


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



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

_______________________________________________
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