Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9ed0443

Browse files
committed
Try-except prevents errors in plot(), but we lose a little feedback.
We need to make sure, eventually, ALL keys have a 'type'. Then we can revert this change.
1 parent 32c86a5 commit 9ed0443

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

plotly/graph_objs/graph_objs.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,19 @@ def validate(self): # TODO: validate values too?
613613
val.validate()
614614
except AttributeError:
615615
if key in INFO[obj_key]:
616-
if INFO[obj_key][key]['type'] == 'object':
617-
msg = ("Class '{cls}' for key '{key}' in '{obj}' "
618-
"graph object is invalid. Valid types for this "
619-
"key are '{types}'.\n\nRun 'help(plotly"
620-
".graph_objs.{obj})' for more information."
621-
"".format(cls=val.__class__.__name__,
622-
key=key,
623-
obj=self.__class__.__name__,
624-
types=INFO[obj_key][key]['val_types']))
625-
raise exceptions.PlotlyError(msg)
616+
try: # TODO: eventually this should be removed...
617+
if INFO[obj_key][key]['type'] == 'object':
618+
msg = ("Class '{cls}' for key '{key}' in '{obj}' "
619+
"graph object is invalid. Valid types for this "
620+
"key are '{types}'.\n\nRun 'help(plotly"
621+
".graph_objs.{obj})' for more information."
622+
"".format(cls=val.__class__.__name__,
623+
key=key,
624+
obj=self.__class__.__name__,
625+
types=INFO[obj_key][key]['val_types']))
626+
raise exceptions.PlotlyError(msg)
627+
except KeyError:
628+
pass
626629
else:
627630
matching_objects = [obj for obj in INFO if key in INFO[obj]]
628631
msg = ("Invalid key, '{key}', for class, '{obj}'\n\nRun "

0 commit comments

Comments
 (0)