@@ -230,15 +230,15 @@ def _write_header(fileobj, header):
230
230
from the beginning of the TCK header).
231
231
"""
232
232
# Fields to exclude
233
- exclude = [Field .MAGIC_NUMBER , Field .NB_STREAMLINES ,
234
- "datatype" , "file" ]
233
+ exclude = [Field .MAGIC_NUMBER , Field .NB_STREAMLINES , Field . ENDIANNESS ,
234
+ "count" , " datatype" , "file" ]
235
235
236
236
lines = []
237
237
lines .append (header [Field .MAGIC_NUMBER ])
238
238
lines .append ("count: {0:010}" .format (header [Field .NB_STREAMLINES ]))
239
239
lines .append ("datatype: Float32LE" ) # Always Float32LE.
240
240
lines .extend (["{0}: {1}" .format (k , v )
241
- for k , v in header .items () if k not in exclude ])
241
+ for k , v in header .items () if k not in exclude and not k . startswith ( "_" ) ])
242
242
lines .append ("file: . " ) # Manually add this last field.
243
243
out = "\n " .join ((asstr (line ).replace ('\n ' , '\t ' ) for line in lines ))
244
244
fileobj .write (asbytes (out ))
@@ -281,7 +281,7 @@ def _read_header(fileobj):
281
281
282
282
with Opener (fileobj ) as f :
283
283
# Read magic number
284
- magic_number = asstr (f .fobj .readline ())
284
+ magic_number = asstr (f .fobj .readline ()). strip ()
285
285
286
286
# Read all key-value pairs contained in the header.
287
287
buf = asstr (f .fobj .readline ())
0 commit comments