New to python coding, getting following error
I can view that testdata.json' that this location using
hdfs dfs -ls /data/testdata.json'
Traceback (most recent call last): File "testdata.json'", line 6, in with open('hdfs:///data/testdata.json') as data_file: IOError: [Errno 2] No such file or directory: 'hdfs:///data/testdata.json' python process_sensor_file.py
#!/bin/python
import json
from pprint import pprint
with open('hdfs:///data/testdata.json', "r") as data_file:
source_data = json.load(data_file)
print(source_data)
print(json.dumps(source_data, indent=2))
for item in source_data['CityData']:
Longitude = item['Longitude']
TimeStamp = item['TimeStamp']
print(Longitude, TimeStamp)