From 18f42076fb57b3abb3bbee63ec0a67c7a3f99611 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 9 Apr 2014 23:08:17 -0400 Subject: [PATCH] allow for same file to be read in as ascii and output as binary --- src/utils/convert_binary.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/convert_binary.py b/src/utils/convert_binary.py index f5feb930f6..48477c27ef 100755 --- a/src/utils/convert_binary.py +++ b/src/utils/convert_binary.py @@ -18,9 +18,8 @@ def ascii_to_binary(ascii_file, binary_file): """ - # Open ASCII and binary files + # Open ASCII file ascii = open(ascii_file, 'r') - binary = open(binary_file, 'wb') # Set default record length record_length = 4096 @@ -29,6 +28,9 @@ def ascii_to_binary(ascii_file, binary_file): lines = ascii.readlines() ascii.close() + # Open binary file + binary = open(binary_file, 'wb') + idx = 0 while idx < len(lines): # Read/write header block