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

TypeError: can't multiply sequence by non-int of type 'float' #154

Closed
dosena opened this issue Jan 10, 2014 · 4 comments
Closed

TypeError: can't multiply sequence by non-int of type 'float' #154

dosena opened this issue Jan 10, 2014 · 4 comments

Comments

@dosena
Copy link

dosena commented Jan 10, 2014

This exception crept in after upgrading from version 0.19.2 to 0.20.0 (and is still present in 0.21.2)

The line in question (preferred.py:170):
return width.value / 100. * table.width

In my case, table.width is 'auto'.

Adding an additional check table.width != 'auto' on line 169 and on line 156 fixes the problem.

  File "/home/nat/.venv/engcalc/local/lib/python2.7/site-packages/weasyprint/layout/blocks.py", line 82, in block_box_layout
    context, box, (containing_block.width, containing_block.height))
  File "/home/nat/.venv/engcalc/local/lib/python2.7/site-packages/weasyprint/layout/tables.py", line 552, in table_wrapper_width
    auto_table_layout(context, wrapper, containing_block)
  File "/home/nat/.venv/engcalc/local/lib/python2.7/site-packages/weasyprint/layout/tables.py", line 492, in auto_table_layout
    context, box, resolved_table_width=True)
  File "/home/nat/.venv/engcalc/local/lib/python2.7/site-packages/weasyprint/layout/preferred.py", line 328, in table_and_columns_preferred_widths
    context, cell, table, resolved_table_width)
  File "/home/nat/.venv/engcalc/local/lib/python2.7/site-packages/weasyprint/layout/preferred.py", line 170, in table_cell_preferred_width
    return width.value / 100. * table.width
TypeError: can't multiply sequence by non-int of type 'float'
@SimonSapin
Copy link
Member

Hi. Thank you for reporting this. It looks like a duplicate of #152. Does upgrading to master fix it? If so I’ll make a PyPI release. To upgrade:

pip install git+https://github.com/Kozea/WeasyPrint.git

@SimonSapin
Copy link
Member

… or maybe this, as we haven’t bumped the version number yet:

pip uninstall WeasyPrint
pip install git+https://github.com/Kozea/WeasyPrint.git

@dosena
Copy link
Author

dosena commented Jan 10, 2014

Yes, upgrading to master fixes it.

@SimonSapin
Copy link
Member

Version 0.21 is on PyPI and fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants