@@ -71,6 +71,7 @@ def load(cls, fh, mode=AUTOMATIC, speedups=True):
7171 name , data = cls ._load_ascii (
7272 fh , header , speedups = speedups )
7373 except RuntimeError as exception :
74+ print ('exception' , exception )
7475 (recoverable , e ) = exception .args
7576 # If we didn't read beyond the header the stream is still
7677 # readable through the binary reader
@@ -136,18 +137,13 @@ def _load_binary(cls, fh, header, check_size=False):
136137
137138 @classmethod
138139 def _ascii_reader (cls , fh , header ):
139- recoverable = [True ]
140- line_separator = b'\n '
141-
142- if b'\r \n ' in header :
143- line_separator = b'\r \n '
144- elif b'\n ' in header :
145- pass
140+ if b'\n ' in header :
141+ recoverable = [True ]
146142 else :
147143 recoverable = [False ]
148144 header += b (fh .read (BUFFER_SIZE ))
149145
150- lines = b (header ).split (line_separator )
146+ lines = b (header ).split (b' \n ' )
151147
152148 def get (prefix = '' ):
153149 prefix = b (prefix ).lower ()
@@ -161,7 +157,7 @@ def get(prefix=''):
161157 recoverable [0 ] = False
162158
163159 # Read more lines and make sure we prepend any old data
164- lines [:] = b (fh .read (BUFFER_SIZE )).split (line_separator )
160+ lines [:] = b (fh .read (BUFFER_SIZE )).split (b' \n ' )
165161 raw_line += lines .pop (0 )
166162
167163 raw_line = raw_line .strip ()
0 commit comments