@@ -230,15 +230,15 @@ def _write_header(fileobj, header):
230230 from the beginning of the TCK header).
231231 """
232232 # 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" ]
235235
236236 lines = []
237237 lines .append (header [Field .MAGIC_NUMBER ])
238238 lines .append ("count: {0:010}" .format (header [Field .NB_STREAMLINES ]))
239239 lines .append ("datatype: Float32LE" ) # Always Float32LE.
240240 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 ( "_" ) ])
242242 lines .append ("file: . " ) # Manually add this last field.
243243 out = "\n " .join ((asstr (line ).replace ('\n ' , '\t ' ) for line in lines ))
244244 fileobj .write (asbytes (out ))
@@ -281,7 +281,7 @@ def _read_header(fileobj):
281281
282282 with Opener (fileobj ) as f :
283283 # Read magic number
284- magic_number = asstr (f .fobj .readline ())
284+ magic_number = asstr (f .fobj .readline ()). strip ()
285285
286286 # Read all key-value pairs contained in the header.
287287 buf = asstr (f .fobj .readline ())
0 commit comments