Open and parse the replay_file. Args: replay_file (string) The file with JSON content to parse. Return: The json package parsed JSON file or None if there was a problem parsing the file.
(replay_file)
| 198 | |
| 199 | |
| 200 | def parse_json(replay_file): |
| 201 | """ Open and parse the replay_file. |
| 202 | |
| 203 | Args: |
| 204 | replay_file (string) The file with JSON content to parse. |
| 205 | |
| 206 | Return: |
| 207 | The json package parsed JSON file or None if there was a problem |
| 208 | parsing the file. |
| 209 | """ |
| 210 | try: |
| 211 | fd = open(replay_file, 'r') |
| 212 | except Exception as e: |
| 213 | logging.exception("Failed to open %s.", replay_file) |
| 214 | raise ParseJSONError(e) |
| 215 | |
| 216 | try: |
| 217 | parsed_json = json.load(fd) |
| 218 | except Exception as e: |
| 219 | message = e.msg.split(':')[0] |
| 220 | logging.error("Failed to load %s as a JSON object: %s", replay_file, e) |
| 221 | raise ParseJSONError(message) |
| 222 | |
| 223 | return parsed_json |
| 224 | |
| 225 | |
| 226 | def readAndCombine(replay_dir, num_sessions_per_file, indent, fabricate_proxy_requests, out_dir): |
no test coverage detected