AWS CLI:解析参数'--item'时出错:预期:'=',收到:'“”用于输入: [英] AWS CLI: Error parsing parameter '--item': Expected: '=', received: '"' for input:

查看:100
本文介绍了AWS CLI:解析参数'--item'时出错:预期:'=',收到:'“”用于输入:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用json作为输入文件简单地插入一项。我在Windows Cmd提示符下运行命令:

  aws2 dynamodb put-item --table-name testCLI --item文件:/ /C:\Temp\DynamoDB\item.json 

表testCLI具有2个属性-ID和值



文件item.json:

  {\  ID\:{\ N\:\ 2\},\ Value\:{\ S\:\来自带有转义字符的json文件\}} 

我遇到了错误:


解析参数'--item'时出错:预期:'=',收到:''输入:
{\ ID\:{ \ N\:\ 2\},\ Value\:{\ S\:\来自带有转义字符的json文件\}}




  aws2 --version 

aws-cli / 2.0.0dev3 Python / 3.7.5 Windows / 10 botocore / 2.0.0dev2


解决方案

该错误是由JSON文件开头和结尾的引号引起的。



但是,将其删除也会

当我使用此文件时,它对我有用(在Mac而非Windows上):

  { ID:{ N: 2}, Value:{ S:来自带有转义字符的json文件} } 


I am trying to simply insert one item using json as input file. I am running command on Windows Cmd prompt:

aws2 dynamodb put-item --table-name testCLI --item file://C:\Temp\DynamoDB\item.json

table testCLI has 2 attributes - ID and Value

File item.json:

"{\"ID\": {\"N\":\"2\"}, \"Value\": {\"S\": \"From json file with escape characters\"}}"

I am getting error:

Error parsing parameter '--item': Expected: '=', received: '"' for input: "{\"ID\": {\"N\":\"2\"}, \"Value\": {\"S\": \"From json file with escape characters\"}}"

aws2 --version

aws-cli/2.0.0dev3 Python/3.7.5 Windows/10 botocore/2.0.0dev2

解决方案

That error is being caused by the quotes at the beginning and end of the JSON file.

However, removing them also seems to cause a problem due to the backslashes.

It worked for me (on a Mac, not Windows) when I used this file:

{"ID": {"N":"2"}, "Value": {"S": "From json file with escape characters"}}

这篇关于AWS CLI:解析参数'--item'时出错:预期:'=',收到:'“”用于输入:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆