read_excel: sheet_name of non-existent sheet does not raise appropriate error for engine='odf' · Issue #27676 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
pandas.read_excel('mybook.ods', sheet_name='mysheet', engine='odf')
Problem description
If the sheet specified does not exist, an error is thrown:
---> 63 raise ValueError("sheet {name} not found".format(name))
64
65 def get_sheet_data(self, sheet, convert_float: bool) -> List[List[Scalar]]:
KeyError: 'name'
The problem is at https://github.com/pandas-dev/pandas/blob/master/pandas/io/excel/_odfreader.py#L63
Expected Output
It should raise a ValueError
with text:
"sheet mysheet not found"
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Linux
OS-release : 5.0.0-20-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 0.25.0
numpy : 1.16.4
pytz : 2019.1
dateutil : 2.8.0
pip : 19.1.1
setuptools : 41.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.6.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : 2.6.9
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.0https://github.com/pandas-dev/pandas/blob/master/pandas/io/excel/_odfreader.py#L63
sqlalchemy : None
tables : 3.5.2
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None