Commit 57448110 authored by Michal Čihař's avatar Michal Čihař

Fix parsing of CSV files

Issue #924
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 9591e769
......@@ -1138,6 +1138,10 @@ class CSVFormat(FileFormat):
"""
storeclass = cls.get_class()
# Did we get file or filename?
if not hasattr(storefile, 'read'):
storefile = open(storefile, 'r')
# Read content for fixups
content = storefile.read()
storefile.seek(0)
......@@ -1150,6 +1154,7 @@ class CSVFormat(FileFormat):
return store
fileobj = StringIOMode(storefile.name, content)
storefile.close()
# Try reading header
reader = csv.reader(fileobj, store.dialect)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment