-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compatibility with Python 2 #103
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Stephen L. <[email protected]>
Also for reference (about the decorator): |
3c896f6
to
a923744
Compare
Hi there, thanks for your contribution! |
@maartenbreddels mmm that's weird, did you try with Python >= 2.7.13 ? Because it's known to work with Python >= 3 since the class management changed, so this issue affects only Python 2. I have ipywidget v7.1.1, I had to update else the widget would not even load with the time old issue of "javascript can't be loaded" or something like that. |
it's 2.7.14, on OSX, using miniconda, and ipyvolume works with that. I'm almost sure it is ipywidget 6 you are using, maybe you have it installed in |
Hey @maartenbreddels , thank you for your suggestion, here is the output: ('7.1.1', 'C:\\Anaconda2\\lib\\site-packages\\ipywidgets\\__init__.pyc') The path is where I initially applied my patch to make ipyvolume works. Also my Python version is 2.7.12, maybe there was an update between .12 and .14 that renders Py2 compatible with such decorator? |
Ok, I need to check this on windows, I only have OSX and Linux now, but I'll try to boot up a virtual machine soon! |
e861e87
to
6dead3f
Compare
This PR fixes a compatibility issue with Python 2: decorating with just
@widgets.register
will transform the decorated class into a function, whereas using@widgets.register()
will correctly return a class. This fixes the following error:With this fix I could successfully run the following simple example:
BTW it would be nice I think to add the mybinder examples in the doc directly, or even the readme, so that new users can easily test out the widget for themselves :-) Otherwise in the doc there is no other example that does not require a 3rd-party library (bokeh etc).