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

ir0*_*539 3 aws-cli

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

未知的输出类型:[无]

我检查了我的配置

$ aws配置

看起来很正常,但是我无法编辑“默认输出格式”

我用--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]
Run Code Online (Sandbox Code Playgroud)

小智 7

$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. 
Run Code Online (Sandbox Code Playgroud)


ir0*_*539 6

我的 ~/.aws/config 不知何故处于不良状态,在单个角色标头下有多个相同设置的声明。手动编辑文件解决了我的问题。

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


小智 5

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

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

  • 很好的答案。将 `JSON` 更改为 `json` 是我的解决方案:`sed 's/JSON/json/g' -i ~/.aws/config` (2认同)