nteract / vdom

🎄 Virtual DOM for Python
https://github.com/nteract/vdom/blob/master/docs/mimetype-spec.md
BSD 3-Clause "New" or "Revised" License
221 stars 34 forks source link

Example notebook doesn't work - Can not modify FrozenDict #101

Open yaananth opened 4 years ago

yaananth commented 4 years ago

Running this: https://github.com/nteract/vdom/blob/10a0f950730efab44574802647e15c1edb05758f/example-notebooks/exploring-elements.ipynb

# Change the value directly from Python
inp.attributes['value'] = "#DD55FF"
# Then update the version in your notebook
hand.update(inp)
ValueError                                Traceback (most recent call last)
<ipython-input-20-a059a19c58d7> in <module>
      1 # Change the value directly from Python
----> 2 inp.attributes['value'] = "#DD55FF"
      3 # Then update the version in your notebook
      4 hand.update(inp)

~\AppData\Local\Programs\Python\Python37\lib\site-packages\vdom\frozendict.py in __setitem__(self, *args, **kwargs)
     24 
     25     def __setitem__(self, *args, **kwargs):
---> 26         return self.__readonly__(super(FrozenDict, self).__setitem__, *args, **kwargs)
     27 
     28     def __delitem__(self, *args, **kwargs):

~\AppData\Local\Programs\Python\Python37\lib\site-packages\vdom\frozendict.py in __readonly__(self, func, *args, **kwargs)
     19     def __readonly__(self, func, *args, **kwargs):
     20         if self.frozen:
---> 21             raise ValueError("Can not modify FrozenDict")
     22         else:
     23             return func(*args, **kwargs)

ValueError: Can not modify FrozenDict
rmorshea commented 4 years ago

Thanks for reporting this.