diff options
author | prathamesh | 2017-11-07 14:16:44 +0530 |
---|---|---|
committer | prathamesh | 2017-11-07 14:16:44 +0530 |
commit | 2eeddaf3bc2eaf9af3fe3e08caec12ff8bc9071a (patch) | |
tree | d433e1495463825f61ea6179e058997654af3fb1 /yaksh/file_utils.py | |
parent | 589c5ecbd4fcafffa2e237012c4c2124b53dca0a (diff) | |
download | online_test-2eeddaf3bc2eaf9af3fe3e08caec12ff8bc9071a.tar.gz online_test-2eeddaf3bc2eaf9af3fe3e08caec12ff8bc9071a.tar.bz2 online_test-2eeddaf3bc2eaf9af3fe3e08caec12ff8bc9071a.zip |
Need nested try..except in is_csv
Diffstat (limited to 'yaksh/file_utils.py')
-rw-r--r-- | yaksh/file_utils.py | 9 |
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) |