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

Graphics in the new notebook output #116

jlperla opened this Issue Jan 5, 2018 · 2 comments


None yet
2 participants

jlperla commented Jan 5, 2018

This is low priority for me (as I can live without graphics in the notebook), but wanted to post it

Using the new notebook function, I tested it on the example.

Calling the FIR_design.jl on its own works correctly on my computer.

When called notebook("FIR_design.jl") on it, everything seems to work, except the Gadfly plot output. If you look at the .ipynb, the output of that cell has a huge amount of xml, starting with

 "outputs": [
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
     "<svg xmlns=\"\"\n",
       "     xmlns:xlink=\"\"\n",
       "     xmlns:gadfly=\"\"\n",
       "     version=\"1.2\"\n",
       "     width=\"141.42mm\" height=\"100mm\" viewBox=\"0 0 141.42 100\"\n",

See the full notebook here:

If you open the notebook, it shows some text instead of the image, but if you <Control-Enter>, it correctly plots the image (so this hasn't broken the underlying code).

As I said, no rush fixing this sort of stuff for me, but when the feature is more formally tested I hope this issue is useful.


This comment has been minimized.


mpastell commented Jan 5, 2018

Thanks for the report! I also noticed the same thing and I'm trying to investigate. The same thing happens with Plots.jl.

Also the same thing happens if you create a notebook using Jupyter and run nbconvert from bash so this not really a bug in Weave as such. Still It would be useful to find and fix the bug. I think it could be a problem with how display is implemented in Gadfly and Plots, but I'm not sure.

The following does work: (but not if I leave out the last call to display):

using Plots
p = plot(1:10)

This comment has been minimized.

jlperla commented Jan 5, 2018

Thanks, works great! It doesn't look like it has anything to do with your package, but I do get errors at the end of the run that look like the following. The file itself is generated fine, so it is very likely my messed up JuliaPro configuration, which I need to redo regardless.

julia> notebook("test_plotting.jmd")
INFO: Running nbconvert
[NbConvertApp] Converting notebook C:\working\libraries\computing_and_datascience\weave_sandbox/test_plotting.ipynb to notebook
[NbConvertApp] Executing notebook with kernel: julia-0.6
[NbConvertApp] Writing 14580 bytes to C:\working\libraries\computing_and_datascience\weave_sandbox/test_plotting.ipynb
[NbConvertApp] Writing 14580 bytes to C:\working\libraries\computing_and_datascience\weave_sandbox/test_plotting.ipynb
--- Logging error ---
Traceback (most recent call last):
  File "logging\", line 983, in emit
OSError: raw write() returned invalid length 240 (should have been between 0 and 120)
Call stack:
  File "", line 184, in _run_module_as_main
  File "", line 85, in _run_code
  File "C:\bin\JuliaPro-\Python\Scripts\jupyter-nbconvert.EXE\", line 9, in <module>
  File "c:\bin\juliapro-\python\lib\site-packages\jupyter_core\", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\bin\juliapro-\python\lib\site-packages\traitlets\config\", line 658, in launch_instance
  File "c:\bin\juliapro-\python\lib\site-packages\nbconvert\", line 325, in start
  File "c:\bin\juliapro-\python\lib\site-packages\nbconvert\", line 493, in convert_notebooks
  File "c:\bin\juliapro-\python\lib\site-packages\nbconvert\", line 465, in convert_single_notebook
    write_results = self.write_single_notebook(output, resources)
  File "c:\bin\juliapro-\python\lib\site-packages\nbconvert\", line 426, in write_single_notebook
    output, resources, notebook_name=notebook_name)
  File "c:\bin\juliapro-\python\lib\site-packages\nbconvert\writers\", line 124, in write"Writing %i bytes to %s", len(output), dest)
  File "logging\", line 1279, in info
  File "logging\", line 1415, in _log
  File "logging\", line 1425, in handle
  File "logging\", line 1487, in callHandlers
  File "logging\", line 855, in handle
  File "logging\", line 986, in emit
Message: 'Writing %i bytes to %s'
Arguments: (14580, 'C:\\working\\libraries\\computing_and_datascience\\weave_sandbox/test_plotting.ipynb')
"Starting kernel event loops.\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment