Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit b44e1fc

Browse files
committed
IO: Excel, attempt to fix broken test
1 parent c84ae1f commit b44e1fc

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pyFAST/case_generation/examples/Example_ExcelFile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def main(run=True):
2323

2424
# --- Reading Excel file, converting it to a list of dictionaries, and generate input files
2525
dfs = io.excel_file.ExcelFile(parametricFile).toDataFrame()
26-
try:
26+
if isinstance(dfs, dict):
2727
df = dfs[list(dfs.keys())[0]]
28-
except:
28+
else:
2929
df = dfs
3030
PARAMS = df.to_dict('records')
3131
fastFiles=case_gen.templateReplace(PARAMS, ref_dir, outputDir=work_dir, removeRefSubFiles=True, removeAllowed=False, main_file=main_file)

pyFAST/input_output/excel_file.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ def formatName():
1818
def _read(self):
1919
self.data=dict()
2020
# Reading all sheets
21-
try:
22-
xls = pd.ExcelFile(self.filename, engine='openpyxl')
23-
except:
24-
xls = pd.ExcelFile(self.filename)
21+
xls = pd.ExcelFile(self.filename, engine='openpyxl')
2522
dfs = {}
2623
for sheet_name in xls.sheet_names:
2724
# Reading sheet
@@ -70,7 +67,7 @@ def _write(self):
7067
writer.save()
7168

7269
def __repr__(self):
73-
s ='Class XXXX (attributes: data)\n'
70+
s ='Class ExcelFile (attributes: data)\n'
7471
return s
7572

7673

0 commit comments

Comments
 (0)