I would strongly suggest you avoid trying to use aliases, since they are A) platform-specific, and B) externally malleable (i.e. they can change without your code knowing). Assuming you don't have any kind of a package management solution for your shell environment, what I would do instead is just pick an RV executable path in your code based on the current platform. An even cleaner approach would be to have the correct RV directory on the PATH already (via init scripts/site environment variable management or something), and just pick a non-absolute executable in your code.
-Nathan From: Matthew Doll Sent: Wednesday, November 19, 2014 6:37 PM To: Nuke Python discussion Subject: [Nuke-python] Popen won't recognize system aliases? Hiya folks, I have aliased RV to "rv" in OSX in .bash_profile -> alias rv='/Applications/RV64.app/Contents/MacOS/RV64' But trying to launch RV from Nuke script editor will not work if I try to use the alias. E.g. this works: def rvFinalCheck(nodelist): cmd = ['/Applications/RV64.app/Contents/MacOS/RV64'] for node in nodelist: cmd.append(node['file'].value()) cmd.append('-over') ocmd = ' '.join(cmd) subprocess.Popen(ocmd, shell=True) But this does not: def rvFinalCheck(nodelist): cmd = ['rv'] for node in nodelist: cmd.append(node['file'].value()) cmd.append('-over') ocmd = ' '.join(cmd) subprocess.Popen(ocmd, shell=True) For this second example, running the command generated from "print ocmd" in a terminal works, but Nuke throws this error: Traceback (most recent call last): File "<string>", line 1, in <module> File "<string>", line 7, in rvFinalCheck File "/Applications/Nuke8.0v6/Nuke8.0v6.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/Applications/Nuke8.0v6/Nuke8.0v6.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory I'd prefer to use the alias for forward-thinking purposes. This has worked just fine in Windows but on OSX I'm stymied. Anyone can tell me what I'm missing? Cheers, Matt -------------------------------------------------------------------------------- _______________________________________________ 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