Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. """
  2. GT CS6476 Computer Vision
  3. Script that prints the results a the JSON file downloaded from Bonnie.
  4.  
  5. Usage:
  6. In the terminal window run:
  7. python print_json.py -f <json_file_path>
  8.  
  9. """
  10.  
  11. import argparse
  12. import json
  13.  
  14.  
  15. def main(data):
  16.  
  17. with open(data.f) as data_file:
  18. json_file = json.load(data_file)
  19.  
  20. tests = json_file["tests"]
  21. for t in tests:
  22. print "----- Test: {} -----".format(t['description'])
  23. print "Pass / Fail: {}".format(t['output']['passfail'])
  24.  
  25. error_msg = t['traceback'].split('Error')
  26. if len(error_msg) > 0:
  27. print "Traceback: {}\n".format(t['traceback'].split('Error')[1])
  28. else:
  29. print "Traceback: {}\n".format(t['traceback'])
  30.  
  31. if __name__ == '__main__':
  32. parser = argparse.ArgumentParser(description="Prints the contents of a JSON file generated by GT's "
  33. "CS6476 Autograder")
  34.  
  35. parser.add_argument('-f')
  36. args = parser.parse_args()
  37.  
  38. main(args)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement