Skip to content

Commit

Permalink
💚 fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Aug 23, 2017
1 parent 789d410 commit ec325aa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pyexcel_xls/xlsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import math
import datetime
import xlrd
from io import UnsupportedOperation

from pyexcel_io.book import BookReader
from pyexcel_io.sheet import SheetReader
from pyexcel_io._compact import OrderedDict
from pyexcel_io._compact import OrderedDict, PY2


XLS_KEYWORDS = [
Expand Down Expand Up @@ -125,8 +126,14 @@ def _get_book(self, on_demand=False):
if self._file_name:
xlrd_params['filename'] = self._file_name
elif self._file_stream:
if hasattr(self._file_stream, 'seek'):
self._file_stream.seek(0)
if PY2:
if hasattr(self._file_stream, 'seek'):
self._file_stream.seek(0)
else:
try:
self._file_stream.seek(0)
except UnsupportedOperation:
pass
file_content = self._file_stream.read()
xlrd_params['file_contents'] = file_content
elif self._file_content is not None:
Expand Down

0 comments on commit ec325aa

Please sign in to comment.