我一直在學習開發一些使用Raspberry Pi的東西3.很明顯,python通常被使用,我也會用它。我正在學習使用pyimagesearch博客的代碼,並提出了一些問題。Raspberry Pi Json解析錯誤
parser= argparse.ArgumentParser()
parser.add_argument("-c","--conf",required=True, help="Path to configuration file")
warnings.filterwarnings("ignore")
conf= json.load(open(args["conf"]))
我得到那裏的錯誤。
Traceback (most recent call last):
File "surveillance_system.py", line 29, in <module>
conf= json.load(open(args["conf"]))
NameError: name 'args' is not defined
所以,我定義的 'ARGS' 的json.load()行
args = vars(parser.parse_args())
之前如下現在,這些錯誤
Traceback (most recent call last):
File "surveillance_system.py", line 29, in <module>
conf= json.load(open(args["conf"]))
File "/usr/lib/python2.7/json/__init__.py", line 290, in load
**kw)
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 14 column 2 (char 264)
所以需要一些幫助。我是python btw的新手。謝謝。
我的回答有幫助你的問題嗎?如果是這樣,請您將我的答案標記爲已接受? – Adrijaned