Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key not found error #2

Open
Maheshkumar094 opened this issue Jan 26, 2019 · 1 comment
Open

key not found error #2

Maheshkumar094 opened this issue Jan 26, 2019 · 1 comment

Comments

@Maheshkumar094
Copy link

Maheshkumar094 commented Jan 26, 2019

``
from csvparser import *
from pyjsonq import JsonQ
channel_list_by_type,channel_list,channel_catagory_list =parse_csv_to_json()
qe =JsonQ(data={"channel_list":channel_list})
res = qe.at('channel_list').where('Channel_type', '=',"Movies Hindi").get()
print(res)
print("len =",len(res))
qe =JsonQ(data={"channel_list":channel_list})
res = qe.at('channel_list').where('Channel_type', '=',"MARATHI").get()
print(res)
print("len =",len(res))

out put

[{'sl_no': 41, 'Channel_type': 'Movies Hindi', 'language': 'Hindi', 'FIREBASE_ID': '41', 'package': '', 'quality': 'SD', 'popularity': 75, 'channel_price': '0', 'is_premium': '0', 'channel_name': 'B4U Movies', 'free': True, 'img_url': ''}, , {'sl_no': 72, 'Channel_type': 'Movies Hindi', 'language': 'Hindi', 'FIREBASE_ID': '72', 'package': '', 'quality': 'HD', 'popularity': 72, 'channel_price': '19', 'is_premium': '1', 'channel_name': 'ZEE Cinema HD', 'free': False, 'img_url': ''}]

('len =', 32)
Traceback (most recent call last):
File "/home/mahesh/firebase/wowd2h/jsonpersing.py", line 10, in
res = qe.at('channel_list').where('Channel_type', '=',"MARATHI").get()
File "/home/mahesh/firebase/wowd2h/.env/local/lib/python2.7/site-packages/pyjsonq/query.py", line 113, in at
self._json_data = self.__get_value_from_data(leaf, self._json_data)
File "/home/mahesh/firebase/wowd2h/.env/local/lib/python2.7/site-packages/pyjsonq/query.py", line 78, in __get_value_from_data
raise KeyError("Key not exists")
KeyError: 'Key not exists'

Process finished with exit code 1

but key "MARATHI" present in json

@davisnando
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants