@@ -214,11 +214,13 @@ def read(table, guess=None, **kwargs):
214214 except :
215215 pass
216216
217- # Get the table from guess in ``dat`` along with an update to the
218- # ``guess`` value. If ``guess`` comes back as False then there is just
219- # one set of kwargs in the guess list so fall through below to the
220- # non-guess way so that any problems result in a more useful traceback.
221- dat , guess = _guess (table , new_kwargs , format , fast_reader_param )
217+ # Get the table from guess in ``dat``. If ``dat`` comes back as None
218+ # then there was just one set of kwargs in the guess list so fall
219+ # through below to the non-guess way so that any problems result in a
220+ # more useful traceback.
221+ dat = _guess (table , new_kwargs , format , fast_reader_param )
222+ if dat is None :
223+ guess = False
222224
223225 if not guess :
224226 reader = get_reader (** new_kwargs )
@@ -302,11 +304,12 @@ def _guess(table, read_kwargs, format, fast_reader):
302304 if guess_kwargs not in filtered_guess_kwargs :
303305 filtered_guess_kwargs .append (guess_kwargs )
304306
305- # If there are not at least two formats to guess then return no table and
306- # indicate that guessing did not occur. In that case the non-guess read()
307- # will occur and any problems will result in a more useful traceback.
307+ # If there are not at least two formats to guess then return no table
308+ # (None) to indicate that guessing did not occur. In that case the
309+ # non-guess read() will occur and any problems will result in a more useful
310+ # traceback.
308311 if len (filtered_guess_kwargs ) <= 1 :
309- return None , False # dat, guess
312+ return None
310313
311314 # Now cycle through each possible reader and associated keyword arguments.
312315 # Try to read the table using those args, and if an exception occurs then
@@ -319,7 +322,7 @@ def _guess(table, read_kwargs, format, fast_reader):
319322
320323 reader = get_reader (** guess_kwargs )
321324 reader .guessing = True
322- return reader .read (table ), True
325+ return reader .read (table )
323326
324327 except (core .InconsistentTableError , ValueError , TypeError , AttributeError ,
325328 core .OptionalTableImportError , core .ParameterError , cparser .CParserError ):
@@ -328,7 +331,8 @@ def _guess(table, read_kwargs, format, fast_reader):
328331 # Failed all guesses, try the original read_kwargs without column requirements
329332 try :
330333 reader = get_reader (** read_kwargs )
331- return reader .read (table ), True
334+ return reader .read (table )
335+
332336 except (core .InconsistentTableError , ValueError , ImportError ,
333337 core .OptionalTableImportError , core .ParameterError , cparser .CParserError ):
334338 failed_kwargs .append (read_kwargs )
0 commit comments