BUG: Handle a ValueError on from_csv calls

The cached market data could be corrupted. Pandas raises a ValueError in
that case, and this error handles it.
This commit is contained in:
Benjamin Berman
2015-04-07 16:00:48 -07:00
committed by Scott Sanderson
parent 885db87dea
commit ef598c7130
+2 -2
View File
@@ -157,7 +157,7 @@ def load_market_data(trading_day=trading_day_nyse,
bm_filepath = get_data_filepath(get_benchmark_filename(bm_symbol))
try:
saved_benchmarks = pd.Series.from_csv(bm_filepath)
except (OSError, IOError):
except (OSError, IOError, ValueError):
logger.info(
"No cache found at {path}. "
"Downloading benchmark data for '{symbol}'.",
@@ -204,7 +204,7 @@ def load_market_data(trading_day=trading_day_nyse,
tr_filepath = get_data_filepath(filename)
try:
saved_curves = pd.DataFrame.from_csv(tr_filepath)
except (OSError, IOError):
except (OSError, IOError, ValueError):
logger.info(
"No cache found at {path}. "
"Downloading treasury data from {source}.",