Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating new book results in TypeError #97

jakedotio opened this issue Jul 31, 2017 · 3 comments

Creating new book results in TypeError #97

jakedotio opened this issue Jul 31, 2017 · 3 comments


Copy link

@jakedotio jakedotio commented Jul 31, 2017

I'm having trouble trying to build a book:

  toc = {'Video': pe.get_sheet(records=video_results),
         'Collection': pe.get_sheet(records=collection_results),
         'Notes': pe.get_sheet(records=notes_results),
         'User': pe.get_sheet(records=user_results)}

  backup = pe.Book(toc)

Results in an TypeError:

Traceback (most recent call last):
  File "./", line 454, in <module>
    generate_backup(filename=filename, project=project)
  File "./", line 198, in generate_backup
    backup = pe.Book(toc)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/", line 40, in __init__
    self.init(sheets=sheets, filename=filename, path=path)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/", line 47, in init
  File "/usr/local/lib/python2.7/site-packages/pyexcel/", line 64, in load_from_sheets
    sheet = Sheet(sheets[name], name)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/", line 87, in __init__
  File "/usr/local/lib/python2.7/site-packages/pyexcel/", line 130, in init
    Matrix.__init__(self, sheet)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/internal/sheets/", line 41, in __init__
    self.__width, self.__array = uniform(array)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/internal/sheets/", line 805, in uniform
    width = longest_row_number(array)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/internal/sheets/", line 793, in longest_row_number
    if len(array) > 0:
TypeError: object of type 'Sheet' has no len()

This is only happening when trying to build a book; running save_as on the individual get_sheet objects work fine and generate the expected output.

chfw added a commit that referenced this issue Jul 31, 2017
… Book constructor. resovles #97
Copy link

@chfw chfw commented Jul 31, 2017

I have accepted your use case. Could you please try again with master branch?

pip install
Copy link

@jakedotio jakedotio commented Aug 1, 2017

Thank you! I didn't realize it wasn't a supported case. The fix worked, and I appreciate you making the change!

Copy link

@chfw chfw commented Aug 1, 2017

released in v0.5.3. thanks for verification.

@chfw chfw closed this Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants