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

Issue with add_table #380

Closed
Ragora opened this Issue Sep 20, 2016 · 3 comments

Comments

2 participants
@Ragora

Ragora commented Sep 20, 2016

add_table throws a misleading warning in the variant of add_table that uses integer columns and rows when the ranges are setup incorrectly. Given this, an error is the expected output but the type of error has caused undue headaches on my part given that the error thrown tells me nothing about why it was actually failing in a much more complicated context.

This is on Python 2.7.6 using xlsxwriter 0.9.3 and Excel 2016.

Demo code:

import xlsxwriter

workbook = xlsxwriter.Workbook("test.xlsx")
sheet = workbook.add_worksheet()
table = {"name": "Test", "data": [], "columns": [ {"header": "One"} ]}

# The table range is incorrect, so an error should be thrown but the wrong one is thrown
sheet.add_table(0, 0, 1, 1, table)

workbook.close()

This is what's thrown:

/usr/local/lib/python2.7/dist-packages/xlsxwriter/worksheet.py:2361: UserWarning: Duplicate header name in add_table(): 'one'
% force_unicode(name))
-1

What it should throw (I'm just filling in what I think it should say):

/usr/local/lib/python2.7/dist-packages/xlsxwriter/worksheet.py:2361: UserWarning: Manually specified table bounds in add_table doesn't line up with the dimensions of the data given!

@jmcnamara jmcnamara added the bug label Sep 20, 2016

@jmcnamara jmcnamara self-assigned this Sep 20, 2016

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Sep 20, 2016

Owner

Thanks for the report. I'll look into it.

Owner

jmcnamara commented Sep 20, 2016

Thanks for the report. I'll look into it.

jmcnamara added a commit that referenced this issue Dec 2, 2016

Fix duplicate header warning in add_table
Fix warning when there is only one header.

Issue #380 and #397.
@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Dec 2, 2016

Owner

Fixed in version 0.94.

Owner

jmcnamara commented Dec 2, 2016

Fixed in version 0.94.

@jmcnamara jmcnamara closed this Dec 2, 2016

@Ragora

This comment has been minimized.

Show comment
Hide comment
@Ragora

Ragora commented Dec 3, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment