summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-03-10 21:13:16 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-03-10 21:13:16 -0700
commit5660d6a67d5c758446f7bb192aad180f4c566073 (patch)
tree33907a0b058eb66021ca814af0398ba0ae9ba26a
parent82cfcb00153d598e4e84c6ebda8bb88b61457ddd (diff)
downloadisort-5660d6a67d5c758446f7bb192aad180f4c566073.tar.gz
Fix issue 895
-rw-r--r--isort/isort.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/isort/isort.py b/isort/isort.py
index 7d971b47..ac21230f 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -136,8 +136,12 @@ class SortImports(object):
self.file_encoding,
file_to_import_sort.encoding))
elif file_:
- self.file_encoding = coding_check(file_)
- file_.seek(0)
+ try:
+ file_.seek(0)
+ self.file_encoding = coding_check(file_)
+ file_.seek(0)
+ except io.UnsupportedOperation:
+ pass
reader = codecs.getreader(self.file_encoding)
file_contents = reader(file_).read()