I've been learning to develop something using a Raspberry Pi 3. As it is obvious that python is generally used, I'm going with it too. I was learning using a code from pyimagesearch blog and I came up with some problem.
parser= argparse.ArgumentParser()
parser.add_argument("-c","--conf",required=True, help="Path to configuration file")
warnings.filterwarnings("ignore")
conf= json.load(open(args["conf"]))
I get there errors.
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
So, I defined 'args' as follows before the json.load() line
args = vars(parser.parse_args())
Now, these errors
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)
So need some help. I am new to python btw. Thank you.