pythonstdin_如何写入Python子进程'stdin?
下面是它的樣子對NUKE 11.3v4的商業版本Windows 10:import subprocess# Run NUKE's script in Terminal mode on Windows machine...subprocess.Popen(['C:/Program Files/Nuke11.3v4/Nuke11.3.exe', '-t', 'E:/NukeTest/test.nk'], stdin=PIPE, stdout=PIPE)
以下是NUKE 11.3v4的非商業版本的工作原理macOS 10.14:import subprocessfrom subprocess import Popen, PIPEimport time# Run NUKE's script in Terminal mode on MacOS machine...np = subprocess.Popen(['/Applications/Nuke11.3v4/NukeX11.3v4 Non-commercial.app/NukeX11.3v4 Non-commercial', '-t', '/Users//Desktop/test.nknc'], stdin=PIPE, stdout=PIPE)# Choose a method to wait for the subprocess to finish...np.wait() time.sleep(5) data = np.communicate(input='data')[0]print(data)
結果如下:'''
NukeX 11.3v4, 64 bit, built May 1 2019.
Copyright (c) 2019 The Foundry Visionmongers Ltd. All Rights Reserved.
Non-commercial mode active.
Licence expires on: 2019/7/27
(11, 3, 4)
('darwin', 'posix')
/Applications/Nuke11.3v4/Nuke11.3v4.app/Contents/MacOS/../Frameworks/Python.framework/Versions/Current/
Disk cache /var/tmp/nuke-u501/ViewerCache/??: 424MB (5% of 10240MB) used in 81 files.
'''
此外,您可以使用-v圖像標志在GUI中運行子進程:subprocess.Popen(['C:/Program Files/Nuke11.3v4/Nuke11.3.exe', '-v', 'E:/NukeTestImages/image.exr'], stdin=PIPE, stdout=PIPE)
希望這可以幫助。
總結
以上是生活随笔為你收集整理的pythonstdin_如何写入Python子进程'stdin?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android studio的布局总结
- 下一篇: 2篇word文档比较重复率_本科论文写作