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

Closed
jakedotio opened this issue Jul 31, 2017 · 3 comments
Closed

Creating new book results in TypeError #97

jakedotio opened this issue Jul 31, 2017 · 3 comments

Comments

@jakedotio
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 "./datatool.py", line 454, in <module>
    generate_backup(filename=filename, project=project)
  File "./datatool.py", line 198, in generate_backup
    backup = pe.Book(toc)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/book.py", line 40, in __init__
    self.init(sheets=sheets, filename=filename, path=path)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/book.py", line 47, in init
    self.load_from_sheets(sheets)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/book.py", line 64, in load_from_sheets
    sheet = Sheet(sheets[name], name)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/sheet.py", line 87, in __init__
    transpose_after=transpose_after
  File "/usr/local/lib/python2.7/site-packages/pyexcel/sheet.py", line 130, in init
    Matrix.__init__(self, sheet)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/internal/sheets/matrix.py", line 41, in __init__
    self.__width, self.__array = uniform(array)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/internal/sheets/matrix.py", line 805, in uniform
    width = longest_row_number(array)
  File "/usr/local/lib/python2.7/site-packages/pyexcel/internal/sheets/matrix.py", 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
@chfw
Copy link
Member

@chfw chfw commented Jul 31, 2017

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

pip install https://github.com/pyexcel/pyexcel/archive/master.zip
@jakedotio
Copy link
Author

@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!

@chfw
Copy link
Member

@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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants