BUG: Fix check for cached public data for Python 2.7

Python 2 and 3 throw different exception types when a file does
not exist.

Catch both exception types to trigger the download, so that the
loader works under both Python versions.
This commit is contained in:
Eddie Hebert
2014-01-07 17:19:16 -05:00
parent 7274748275
commit 71cda461c5
+2 -2
View File
@@ -158,7 +158,7 @@ def load_market_data(bm_symbol='^GSPC'):
bm_filepath = get_data_filepath(get_benchmark_filename(bm_symbol))
try:
saved_benchmarks = pd.Series.from_csv(bm_filepath)
except OSError:
except (OSError, IOError):
print("""
data files aren't distributed with source.
Fetching data from Yahoo Finance.
@@ -205,7 +205,7 @@ Fetching data from Yahoo Finance.
tr_filepath = get_data_filepath(filename)
try:
saved_curves = pd.DataFrame.from_csv(tr_filepath)
except OSError:
except (OSError, IOError):
print("""
data files aren't distributed with source.
Fetching data from {0}