Skip to content

Commit

Permalink
tools: fix Python 3 issues in inspector_protocol
Browse files Browse the repository at this point in the history
PR-URL: nodejs#29296
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
cclauss authored and aduh95 committed Mar 4, 2021
1 parent a0bae95 commit fa98a8b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tools/inspector_protocol/convert_protocol_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ def main(argv):
parser.add_argument("json_file", help="The .json output file write.")
args = parser.parse_args(argv)
file_name = os.path.normpath(args.pdl_file)
input_file = open(file_name, "r")
pdl_string = input_file.read()
with open(file_name, "r") as input_file:
pdl_string = input_file.read()
protocol = pdl.loads(pdl_string, file_name, args.map_binary_to_string)
input_file.close()

output_file = open(os.path.normpath(args.json_file), 'wb')
json.dump(protocol, output_file, indent=4, separators=(',', ': '))
output_file.close()
with open(os.path.normpath(args.json_file), 'w') as output_file:
json.dump(protocol, output_file, indent=4, separators=(',', ': '))


if __name__ == '__main__':
Expand Down

0 comments on commit fa98a8b

Please sign in to comment.