我遇到了一個很奇怪的問題 - 當我使用argparser.add_argument()
方法時,我得到ArgumentError()
。python:argparser.add_argument()cause ArgumentError()
from oauth2client.tools import argparser, run_flow
if __name__ == "__main__":
argparser.add_argument("--videoid", default="L-oNKK1CrnU",
help="ID of video to like.")
我正在與PDB代碼,這就是我得到的錯誤:
(Pdb) n
ArgumentError: ArgumentError()
> c:\py\googleapitest.py(48)<module>()->None
-> help="ID of video to like.")
這是根本原因:
C:\Python27\lib\argparse.pyc in _handle_conflict_error(self, action, conflicting_actions)
1452 for option_string, action
1453 in conflicting_actions])
-> 1454 raise ArgumentError(action, message % conflict_string)
即使我遇到了錯誤如果我不通過「幫助」參數。
我在做什麼錯?
什麼是'argparser'? – dm295
@dm295 from oauth2client.tools import argparser – golosovsky
這將有助於瞭解如何定義'argparser'。它會出現一個名爲'--videoid'的選項。 – chepner