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 
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

Reply via email to