【发布时间】:2017-09-25 21:18:29
【问题描述】:
#main loop
while 1==1:
#If they click Yes on the dialog box begin recording, otherwise ask again
easygui.msgbox('This is what the last person suggested! Press ok to record.: ' + output_string, 'Title', ok_button= "OK")
N+=1
counterFile = open('counterFile','w')
counterFile.write(str(N));
counterFile.close()
camera.start_recording('video' + str(N) + '.h264')
audioRecord()
camera.stop_recording()
output_string_old = output_string;
output_string = TextEnter()
filename = ConvertMerge()
argparser.add_argument("--file")
argparser.add_argument("--title")
argparser.add_argument("--description")
argparser.add_argument("--category")
argparser.add_argument("--keywords")
argparser.add_argument("--privacyStatus")
args = argparser.parse_args(["--file", filename, "--title", str(N),"--description", output_string_old, "--category", "22", "--keywords", " ", "--privacyStatus", "public"])
initialize_upload(get_authenticated_service(args), args)
我已经编写了这段代码来记录镜头,然后使用 youtube api 上传到 youtube,但它目前在第二个循环中返回此错误。
ArgumentError:参数--file:冲突的选项字符串:--file
filename ='mergedVideo'+ str(N) + '.mkv' 并在每次程序运行时增加。
为什么第二个循环会出现这个错误?
【问题讨论】:
-
你能在你的代码中包含循环吗?
-
@Sweater-Baron 有帮助吗?我是一个非常业余的编码员,所以这可能很混乱......
-
您刚刚发布的代码似乎失去了缩进。或者你的源文件中的代码也没有缩进?
-
@Sweater-Baron 抱歉,我复制它时出错了。已排序!关于代码的任何其他问题我都非常乐意回答。
-
第一次通过您将一组
arguments添加到现有的argparser(我相信是由youtubeapi 创建的)。您不能添加更多同名参数。可以再次调用parse_args,但不能重复使用add_argument('--file'...)。
标签: python youtube-api arguments argparse