Skip to content

Commit 67672dd

Browse files
committed
force 'specs' to be list of lists
1 parent 7bb6ba2 commit 67672dd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

plotly/tools.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,14 +670,16 @@ def make_subplots(rows=1, cols=1,
670670
except KeyError:
671671
vertical_spacing = 0.3 / rows
672672

673-
# Sanitize 'specs'
673+
# Sanitize 'specs' (must be a list of lists)
674+
exception_msg = "Keyword argument 'specs' must be a list of lists"
674675
try:
675676
specs = kwargs['specs']
676677
if not isinstance(specs, list):
677-
raise Exception("Keyword argument 'specs' must be a list")
678-
elif isinstance(specs[0], dict):
679-
# To support one-row specs=[{},{}]
680-
specs = [specs]
678+
raise Exception(exception_msg)
679+
else:
680+
for spec_row in specs:
681+
if not isinstance(spec_row, list):
682+
raise Exception(exception_msg)
681683
except KeyError:
682684
specs = [[{}
683685
for c in range(cols)]

0 commit comments

Comments
 (0)