AWS CLI - 所有命令都返回未知输出类型:[无]

时间:2018-02-07 01:23:54

标签: aws-cli

我的所有aws-cli命令都返回

  

未知输出类型:[无]

我检查了我的配置

  

$ aws configure

显示正常,但我无法编辑“默认输出格式”

我用--debug运行了我的aws-cli命令并看到了

MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 208, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 345, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 517, in __call__
    call_parameters, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 638, in invoke
    self._display_response(operation_name, response, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/clidriver.py", line 657, in _display_response
    formatter = get_formatter(output, parsed_globals)
  File "/Library/Python/2.7/site-packages/awscli/formatter.py", line 272, in get_formatter
    raise ValueError("Unknown output type: %s" % format_type)
ValueError: Unknown output type: [None]

3 个答案:

答案 0 :(得分:3)

$aws configure
press Enters
see the "Default output format [None]:" 
input one of "json, text or table "(all in lower case) 
after that rerun your command. 

答案 1 :(得分:3)

运行命令"aws configure",然后检查"JSON"中的单词"Default output format [JSON]:"是大写还是小写?如果是大写,则运行任何 aws 命令都会显示 "Unknown ouput type : JSON"
或者打开文件 C:\Users\<user>\.aws\config 文件并检查条目 "output = json"。如果单词 json 为大写,则运行任何 aws 命令都会显示 "Unknown ouput type : JSON"

解决方案:
用小写的 json 替换大写的 JSON。

答案 2 :(得分:1)

我的〜/ .aws / config在某种程度上处于不良状态,在单个角色标题下有相同设置的多个声明。手动编辑文件修复了我的问题。

配置设置和优先级https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html下的信息使我找到了正确的位置。