diff --git a/IPython/html/widgets/widget_selection.py b/IPython/html/widgets/widget_selection.py index aa3f194..e9706d1 100644 --- a/IPython/html/widgets/widget_selection.py +++ b/IPython/html/widgets/widget_selection.py @@ -59,6 +59,10 @@ class _SelectionWidget(DOMWidget): if isinstance(values, list): # preserve list order with an OrderedDict kwargs['values'] = OrderedDict((unicode_type(v), v) for v in values) + # python3.3 turned on hash randomization by default - this means that sometimes, randomly + # we try to set value before setting values, due to dictionary ordering. To fix this, force + # the setting of self.values right now, before anything else runs + self.values = kwargs.pop('values') DOMWidget.__init__(self, *args, **kwargs) def _values_changed(self, name, old, new): diff --git a/examples/Interactive Widgets/Export As (nbconvert).ipynb b/examples/Interactive Widgets/Export As (nbconvert).ipynb index 714b48a..9c6e758 100644 --- a/examples/Interactive Widgets/Export As (nbconvert).ipynb +++ b/examples/Interactive Widgets/Export As (nbconvert).ipynb @@ -19,7 +19,8 @@ "# nbconvert related imports\n", "from IPython.nbconvert import get_export_names, export_by_name\n", "from IPython.nbconvert.writers import FilesWriter\n", - "from IPython.nbformat import current" + "from IPython.nbformat import current\n", + "from IPython.nbconvert.utils.exceptions import ConversionException" ], "language": "python", "metadata": {}, @@ -151,7 +152,7 @@ " download_link.value = \"
Results: \\\"{filename}\\\"\".format(filename=write_results)\n", " download_link.visible = True\n", " \n", - "def handle_export():\n", + "def handle_export(widget):\n", " with open(filename, 'r') as f:\n", " export(filename, current.read(f, 'json'))\n", "export_button.on_click(handle_export)" @@ -183,4 +184,4 @@ "metadata": {} } ] -} \ No newline at end of file +}