Passing Row/Column Dimension `"s"` argument raises TypeError: int object is not iterable

Issue #1120 invalid
Benjamin Hauch
created an issue

Python 3.6 x64 & openpyxl 2.5.9


from openpyxl.worksheet.dimensions import RowDimension
source_format = {
    "s": 0,
ws =
rd = RowDimension(ws, **source_format)

Stack Trace:

  File ".....\openpyxl\worksheet\", line 110, in __init__
    collapsed, worksheet, style=s)
  File ".....\openpyxl\worksheet\", line 44, in __init__
    super(Dimension, self).__init__(sheet=worksheet, style_array=style)
  File ".....\openpyxl\styles\", line 132, in __init__
    style_array = StyleArray(style_array)
  File ".....\openpyxl\styles\", line 54, in __new__
    return array.__new__(cls, 'i', args)
TypeError: 'int' object is not iterable

I believe this bug dates to commit which changed the initialization of the Dimension class, passing s to the StyleArray constructor even though s is the style_id - explicitly an int and not an iterable.

Comments (2)

  1. CharlieC

    I don't really understand what you're trying to do here. s as integer is really implementation detail relating to how the stuff is serialised as XML. The openpyxl API presents a StyleableObject where you set formats directly. Also, Dimension objects should be obtained already bound to the worksheet from the relevant collection.

  2. Log in to comment