Seems to be working. Thanks guys! Next step is putting script into my After Render callback for the automation. I've done this by calling this script sendToCompressor() and adding it to my write node. Everything seems to work, however I'm not getting the output from Compressor of the new file. Im guessing Nuke has not finished creating .mov file and has run the script.
import os import subprocess def sendToCompressor(): compressorPath = '/Applications/Compressor.app/Contents/MacOS/Compressor' a=nuke.thisNode() b=a['file'].value() u=os.path.split(b) [0] u = os.path.normpath (u) oldName = os.path.split(b) [1] oldName = os.path.splitext(oldName) [0] fileType= a['file_type'].value() newName = '%s/%s_422HQ.%s' % (u,oldName, fileType) cmd = '%s -clustername \'This Computer\' -jobpath %s -settingpath /Applications/Compressor.app/Contents/Resources/English.lproj/Formats/QuickTime/Apple\ ProRes\ 422\ \(HQ\).setting -destinationpath %s' % (compressorPath, b,newName) from subprocess import Popen, PIPE, STDOUT p = Popen([cmd], stdout=PIPE, stdin=PIPE, stderr=STDOUT, shell=True) print cmd output = p.communicate() print(output) Harrison Ly www.harrisonly.co.uk [email protected] +44 (0)7784111844 On 9 September 2013 17:51, Nathan Rusch <[email protected]> wrote: > If you’re pre-constructing a command string, pass it directly (i.e. not > in a list) and pass `shell=True` to the Popen constructor. However, in this > case, I would just build and pass your command as a list. > > -Nathan > > > *From:* Harrison Ly <[email protected]> > *Sent:* Monday, September 09, 2013 5:42 AM > *To:* [email protected] > *Subject:* [Nuke-python] Send file to Compressor > > > Hi All, > > > > I'm trying to send a footage file to compressor on osx via the terminal > from Nuke. I've got the command line working which does the job if I > manually copy and paste the output into terminal. When I use 'Popen' with > 'cmd' it returns an error. Anyone can direct me the right way? > > > > import os > > import subprocess > > > > compressorPath = '/Applications/Compressor.app/Contents/MacOS/Compressor' > > a=nuke.selectedNode() > > b=a['file'].value() > > u=os.path.split(b) [0] > > u = os.path.normpath (u) > > oldName = os.path.split(b) [1] > > oldName = os.path.splitext(oldName) [0] > > fileType= a['file_type'].value() > > newName = '%s/%s_4444HQ.%s' % (u,oldName, fileType) > > > > cmd = '%s -clustername \'This Computer\' -jobpath %s -settingpath > /Applications/Compressor.app/Contents/Resources/English.lproj/Formats/QuickTime/Apple\ > ProRes\ 422\ \(HQ\).setting -destinationpath %s' % (compressorPath, > b,newName) > > > > from subprocess import Popen, PIPE, STDOUT > > p = Popen([cmd], stdout=PIPE, stdin=PIPE, stderr=STDOUT) > > output = p.communicate(input='ls') > > print(output) > > > Harrison Ly > > www.harrisonly.co.uk > [email protected] > +44 (0)7784111844 > > ------------------------------ > _______________________________________________ > 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 > >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
