Re: Using Holoview in @Jupyter Nodes
On Sun, Mar 11, 2018 at 8:45 AM, Thomas Passin wrote: > I have only done this for a notebook located on my own computer. You have > to use "file:///" and I changed the backslashes (I'm on Windows) to forward > slashes: > > file:///C:/Users/tom/holoview_tests.ipynb > ​Thanks. I understand the code again :-) I'll update the docstring soon. This works for me on Ubuntu, but not on Windows. I'll investigate, but it's good to know that it's working for me. Recent revs allow the @jupyter node to contain the actual json from the .ipynb file. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Using Holoview in @Jupyter Nodes
I have only done this for a notebook located on my own computer. You have to use "file:///" and I changed the backslashes (I'm on Windows) to forward slashes: file:///C:/Users/tom/holoview_tests.ipynb The right syntax for a file URL seems to confuse people. I think the RFCs aren't too clear. "file:///" is correct - the protocol is "file", and there is no server (so "//server/" becomes "///"). But many programs want you to use "file:/c:/..."), and there can be other variants. I just try all the combinations I can think of until one of them works. Just as a reminder, this is using VR, *not* VR2. On Sunday, March 11, 2018 at 8:35:06 AM UTC-4, Edward K. Ream wrote: > > On Saturday, March 10, 2018 at 8:26:21 PM UTC-6, Thomas Passin wrote: > > > Run the code in Jupyter Notebook. Let it finish and display the graphic, > then save the notebook... > > ViewRendered will be able to show the graphic in the @jupyter node. > > Many thanks for this. I had completely forgotten that the VR plugin > supports @jupyter nodes! Sheesh. gitk tells me I wrote this on 2017-01-05. > > There is nothing in the docstring about @jupyter. Thomas, what do you > paste into the body text? A url, json or html? Anything you can add will > find it's way into the docstring. > > Edward > > P.S. For my reference, the update_jupyter method does the rendering: Here > is the guts of the code: > > import nbformat > from nbconvert import HTMLExporter > from urllib.request import urlopen > ... > url = g.getUrlFromNode(c.p) > if url and nbformat: > s = urlopen(url).read().decode() > try: > nb = nbformat.reads(s, as_version=4) > e = HTMLExporter() > (s, junk_resources) = e.from_notebook_node(nb) > except nbformat.reader.NotJSONError: > # Assume the result is html. > pass > elif url: > s = 'can not import nbformt: %r' % url > else: > s = g.u('') > w.setHtml(s) > > Edward > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Using Holoview in @Jupyter Nodes
On Saturday, March 10, 2018 at 8:26:21 PM UTC-6, Thomas Passin wrote: > Run the code in Jupyter Notebook. Let it finish and display the graphic, then save the notebook... > ViewRendered will be able to show the graphic in the @jupyter node. Many thanks for this. I had completely forgotten that the VR plugin supports @jupyter nodes! Sheesh. gitk tells me I wrote this on 2017-01-05. There is nothing in the docstring about @jupyter. Thomas, what do you paste into the body text? A url, json or html? Anything you can add will find it's way into the docstring. Edward P.S. For my reference, the update_jupyter method does the rendering: Here is the guts of the code: import nbformat from nbconvert import HTMLExporter from urllib.request import urlopen ... url = g.getUrlFromNode(c.p) if url and nbformat: s = urlopen(url).read().decode() try: nb = nbformat.reads(s, as_version=4) e = HTMLExporter() (s, junk_resources) = e.from_notebook_node(nb) except nbformat.reader.NotJSONError: # Assume the result is html. pass elif url: s = 'can not import nbformt: %r' % url else: s = g.u('') w.setHtml(s) Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.