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

Parsing JSON issues #1

Open
psachin opened this issue Jan 17, 2017 · 2 comments
Open

Parsing JSON issues #1

psachin opened this issue Jan 17, 2017 · 2 comments

Comments

@psachin
Copy link

psachin commented Jan 17, 2017

  • raw_input error
psachin@nubia:[refactor-parseJSON :( ]$ python Parsing_JSON.py instackenv.json 
0 b'arch'
1 b'cpu'
2 b'disk'
3 b'mac'
4 b'memory'
5 b'pm_addr'
6 b'pm_password'
7 b'pm_type'
8 b'pm_user'
Traceback (most recent call last):
  File "Parsing_JSON.py", line 20, in <module>
    inputvalues=raw_input("Enter the comma separated numeric values. ")
NameError: name 'raw_input' is not defined
  • orderable type error
psachin@nubia:[refactor-parseJSON :( ]$ python Parsing_JSON.py instackenv.json 
0 b'arch'
1 b'cpu'
2 b'disk'
3 b'mac'
4 b'memory'
5 b'pm_addr'
6 b'pm_password'
7 b'pm_type'
8 b'pm_user'
Enter the comma separated numeric values. 1
Traceback (most recent call last):
  File "Parsing_JSON.py", line 52, in <module>
    input_validation()
  File "Parsing_JSON.py", line 46, in input_validation
    if (len(sorted(data['nodes'][0].keys()))-1) > each_input_number:
TypeError: unorderable types: int() > str()
@psachin
Copy link
Author

psachin commented Jan 17, 2017

This works for me on python-3.5(You may need to adapt it for 2.7)

https://gist.github.com/psachin/792bb478f68629bd559911ad5ec8ef29

@psachin
Copy link
Author

psachin commented Feb 7, 2017

Refactored + implemented argparser

https://gist.github.com/psachin/c70c960c60f0f0b56320e1900c1ae073

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

1 participant