This commit is contained in:
chfw 2017-08-23 23:33:13 +01:00
parent faf28f2735
commit c6bbd2b58c
2 changed files with 7 additions and 5 deletions

View File

@ -32,7 +32,7 @@ from odf.opendocument import load
from pyexcel_io.book import BookReader
from pyexcel_io.sheet import SheetReader
from pyexcel_io._compact import OrderedDict, PY2
from pyexcel_io._compact import OrderedDict, BytesIO
import pyexcel_ods.converter as converter
@ -105,6 +105,10 @@ class ODSBook(BookReader):
def open_stream(self, file_stream, **keywords):
"""open ods file stream"""
if not hasattr(file_stream, 'seek'):
# Hei zipfile in odfpy would do a seek
# but stream from urlib cannot do seek
file_stream = BytesIO(file_stream.read())
BookReader.open_stream(self, file_stream, **keywords)
self._load_from_memory()

View File

@ -102,7 +102,7 @@ def test_issue_19():
test_file = "pyexcel_81_ods_19.ods"
data = get_data(get_fixtures(test_file),
skip_empty_rows=True)
eq_(data['product.template'][1][1], 'PRODUCT NAME PMP')
eq_(data['product.template'][1][1], 'PRODUCT NAME PMP')
def test_issue_83_ods_file_handle():
@ -141,9 +141,7 @@ def test_pr_22():
eq_(data['Sheet1'][0][0], 'paragraph with tab(\t), space, \nnew line')
def test_issue_20():
if not IN_TRAVIS:
raise SkipTest()
def test_issue_23():
pe.get_book(url="https://github.com/pyexcel/pyexcel-ods/raw/master/tests/fixtures/white_space.ods"); # flake8: noqa