summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/file_utils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/yaksh/file_utils.py b/yaksh/file_utils.py
index 4b8640e..0d80b8f 100644
--- a/yaksh/file_utils.py
+++ b/yaksh/file_utils.py
@@ -53,10 +53,11 @@ def extract_files(zip_file, path=None):
def is_csv(document):
try:
- content = document.read(1024).decode('utf-8')
- except AttributeError:
- document.seek(0)
- content = document.read(1024)
+ try:
+ content = document.read(1024).decode('utf-8')
+ except AttributeError:
+ document.seek(0)
+ content = document.read(1024)
sniffer = csv.Sniffer()
dialect = sniffer.sniff(content)
document.seek(0)