我在传递参数时遇到了以下错误。谁能帮我确定这个问题?我在终端中向我的函数传递指令,如下所示:
python makeQuicktime.py -i /Volumes/P003A/TM_Cloud/Nagrania/Karta_04/XDROOT/Clip/D004C010_141026MM.MXF -f 25 -c prores
这是主要功能 - 如您所见,我尝试将参数 --codec 作为字符串传递:
if __name__ == "__main__":
args = docopt(__doc__, version='makeQuicktime 0.0.1')
print args
cmd_args = ""
codec=str(args['--codec'])
makeQuicktime( args['--input'], fps=args['--fps'], codec=str(args['--codec']) )
os._exit(0)
此代码正在运行的其他函数的一部分(makeProRes,第 110 行是输出变量):
subprocess.call([FFMPEG_PATH, 'i', input,
'-start_number', start_frame, '-r', fps,
'-c:v', 'prores',
'-profile:v', '2',
'-c:a', 'copy',
'-threads', cpus,
output
])
错误:
Traceback (most recent call last):
File "makeQuicktime.py", line 123, in <module>
makeQuicktime( args['--input'], fps=args['--fps'], codec=str(args['--codec']) )
File "makeQuicktime.py", line 53, in makeQuicktime
makeProRes(1, input, fps, output)
File "makeQuicktime.py", line 110, in makeProRes
output
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 524, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
TypeError: execv() arg 2 must contain only strings