我使用 OptionParser 有以下选项
parser = OptionParser()
parser.add_option("-submitted.cl", "--change_list", dest="change_list",help="Submitted Change list")
parser.add_option("-submitted.cr", "--crlist", dest="cr_list",help="Submitted CR list")
parser.add_option("-build.location", "--sbl", dest="sbl",help="Source build location")
parser.add_option("-filer.location", "--dbl", dest="dbl",help="Filer location")
parser.add_option("-users", "--users",dest="users",help="Users")
(options, args) = parser.parse_args()
我正在使用以下选项运行脚本并遇到以下错误,请提供有关如何修复它的输入。
python save_build_artifacts.py 12345 02384 \\ben\cnss_dev_integration\nfc_builds\LA_host_builds\8084\Build2 \\ben\cnss_dev_integration\temp gnakkala
错误:-
Traceback (most recent call last):
File "save_build_artifacts.py", line 75, in <module>
main()
File "save_build_artifacts.py", line 43, in main
parser.add_option("-submitted.cl", "--change_list", dest="change_list",help="Submitted Change list")
File "C:\Python27\lib\optparse.py", line 1012, in add_option
option = self.option_class(*args, **kwargs)
File "C:\Python27\lib\optparse.py", line 566, in __init__
self._set_opt_strings(opts)
File "C:\Python27\lib\optparse.py", line 606, in _set_opt_strings
self)
optparse.OptionError: invalid long option string '-submitted.cl': must start with --, followed by non-dash