Skip to content
Snippets Groups Projects
Commit 0b4ddcd1 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

FIX: treat filename=None correctly

parent 4ad7df78
No related branches found
No related tags found
1 merge request!22Release 0.3
......@@ -73,10 +73,9 @@ class XLS_Importer(object):
try:
xls_file = pd.io.excel.ExcelFile(filename)
except XLRDError as e:
errmsg = ("Cannot read {}.".format(filename) if "\n"+filename+"\n"
else "the file.")
logger.warning(
errmsg,
"Cannot read \n{}.\nError:{}".format(filename,
str(e)),
extra={'identifier': str(filename),
'category': "inconsistency"})
raise DataInconsistencyError(*e.args)
......@@ -91,10 +90,8 @@ class XLS_Importer(object):
try:
df = xls_file.parse(converters=self.converters)
except Exception as e:
errmsg = ("Cannot parse {}.".format(filename) if "\n"+filename+"\n"
else "the file.")
logger.warning(
errmsg,
"Cannot parse {}.".format(filename),
extra={'identifier': str(filename),
'category': "inconsistency"})
raise DataInconsistencyError(*e.args)
......@@ -111,7 +108,7 @@ class XLS_Importer(object):
for col in self.required_columns:
if col not in df.columns:
errmsg = "Column '{}' missing in ".format(col)
errmsg += ("{}.".format(filename) if "\n"+filename+"\n"
errmsg += ("\n{}.\n".format(filename) if filename
else "the file.")
errmsg += "Stopping to treat this file..."
logger.warning(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment