File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -126,9 +126,11 @@ def _get_book(self, on_demand=False):
126
126
if self ._file_name :
127
127
xls_book = xlrd .open_workbook (self ._file_name , on_demand = on_demand )
128
128
elif self ._file_stream :
129
+ self ._file_stream .seek (0 )
130
+ file_content = self ._file_stream .read ()
129
131
xls_book = xlrd .open_workbook (
130
132
None ,
131
- file_contents = self . _file_stream . getvalue () ,
133
+ file_contents = file_content ,
132
134
on_demand = on_demand
133
135
)
134
136
elif self ._file_content is not None :
Original file line number Diff line number Diff line change @@ -62,5 +62,11 @@ def test_issue_13_empty_file_content():
62
62
pe .get_sheet (file_content = '' , file_type = 'xls' )
63
63
64
64
65
+ def test_issue_16_file_stream_has_no_getvalue ():
66
+ test_file = get_fixture ("hidden_sheets.xls" )
67
+ with open (test_file , 'rb' ) as f :
68
+ pe .get_sheet (file_stream = f , file_type = 'xls' )
69
+
70
+
65
71
def get_fixture (file_name ):
66
72
return os .path .join ("tests" , "fixtures" , file_name )
You can’t perform that action at this time.
0 commit comments