Python使用命令提示符传递参数

时间:2018-02-28 17:56:59

标签: python youtube

我是Python新手。但是,我试图使用命令提示符运行代码(Found here),我收到以下错误:

usage: vogon.py [-h] [--auth_host_name AUTH_HOST_NAME]
                [--noauth_local_webserver]
                [--auth_host_port [AUTH_HOST_PORT [AUTH_HOST_PORT ...]]]
                [--logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                [--youtube_upload] [--preview_line PREVIEW_LINE]
                config_file
vogon.py: error: argument --youtube_upload: ignored explicit argument 'Yes'

我用来执行它的命令是:

>python vogon.py --config_file=sample_win.json --auth_host_name=http://localhost/ --auth_host_port=8080 --logging_level=DEBUG --youtube_upload=Yes --preview_line=2

我该如何解决这个问题?

更新

> File "vogon.py", line 351, in <module>
>     main()   File "vogon.py", line 348, in main
>     generate_videos(args.config_file, args.youtube_upload, args.preview_line, args)   File "vogon.py", line 68, in
> generate_videos
>     video = generate_video(config, row, (i + 1))   File "vogon.py", line 100, in generate_video
>     filters = filter_strings(image_overlays, text_overlays)   File "vogon.py", line 127, in filter_strings
>     ovr['y'], ovr['h_align'], ovr['start_time'], KeyError: 'h_align

'

1 个答案:

答案 0 :(得分:0)

该选项用

定义
parser.add_argument("--youtube_upload",
        help="Upload generated videos to YouTube",
        action="store_true")

--youtube_upload不接受任何论点;放弃=YES

完整命令(使用shell line continuation分割成多行)似乎是

python vogon.py --auth_host_name=http://localhost/ \
                --auth_host_port=8080 \
                --logging_level=DEBUG \
                --youtube_upload \ 
                --preview_line=2 \
                sample_win.json