has2k1 / gnuplot_kernel

A Jupyter/IPython kernel for gnuplot
BSD 3-Clause "New" or "Revised" License
84 stars 25 forks source link

issue getting gnu_magic to work #7

Closed lafosse closed 7 years ago

lafosse commented 7 years ago

Hello,

I have installed the latest versions of jupyter notebook, gnuplot, and metakernel on my system.

I'm attempting to use your gnuplot_kernel with gnuplot magic inside of a Python 3 notebook. I'm not quite sure what the issue is.

I am using your gnuplot-magic.ipynb file as a test-case for this.

The first cell in the notebook with "%load_ext gnuplot_kernel" runs just fine with no error. However, when I attempt to run gnuplot in a cell with %%gnuplot to enable gnuplot magic, I get the following error:


AttributeError Traceback (most recent call last)

in () ----> 1 get_ipython().magic('gnuplot inline') /Users/lafosse/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py in magic(self, arg_s) 2156 magic_name, _, magic_arg_s = arg_s.partition(' ') 2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) -> 2158 return self.run_line_magic(magic_name, magic_arg_s) 2159 2160 #------------------------------------------------------------------------- /Users/lafosse/anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line) 2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 2078 with self.builtin_trap: -> 2079 result = fn(*args,**kwargs) 2080 return result 2081 /Users/lafosse/anaconda/lib/python3.5/site-packages/gnuplot_kernel/magics/gnuplot_magic.py in gnuplot(line) 119 @register_line_magic 120 def gnuplot(line): --> 121 magic.line_gnuplot(line) 122 123 del gnuplot /Users/lafosse/anaconda/lib/python3.5/site-packages/gnuplot_kernel/magics/gnuplot_magic.py in line_gnuplot(self, *args) 63 self.kernel.plot_settings['termspec'] = termspec 64 self.kernel.plot_settings['format'] = format ---> 65 self.kernel.handle_plot_settings() 66 67 def cell_gnuplot(self): /Users/lafosse/anaconda/lib/python3.5/site-packages/gnuplot_kernel/kernel.py in handle_plot_settings(self) 278 279 cmd = 'set terminal {}'.format(settings['termspec']) --> 280 super(GnuplotKernel, self).do_execute_direct(cmd) /Users/lafosse/anaconda/lib/python3.5/site-packages/metakernel/process_metakernel.py in do_execute_direct(self, code, silent) 109 if output: 110 if stream_handler: --> 111 stream_handler(output) 112 else: 113 return TextOutput(output) /Users/lafosse/anaconda/lib/python3.5/site-packages/metakernel/_metakernel.py in Print(self, *args, **kwargs) 638 'name': 'stdout', 'text': message} 639 self.log.debug('Print: %s' % message) --> 640 self.send_response(self.iopub_socket, 'stream', stream_content) 641 642 def Write(self, message): /Users/lafosse/anaconda/lib/python3.5/site-packages/ipykernel/kernelbase.py in send_response(self, stream, msg_or_type, content, ident, buffers, track, header, metadata) 344 """ 345 return self.session.send(stream, msg_or_type, content, self._parent_header, --> 346 ident, buffers, track, header, metadata) 347 348 def init_metadata(self, parent): /Users/lafosse/anaconda/lib/python3.5/site-packages/jupyter_client/session.py in send(self, stream, msg_or_type, content, parent, ident, buffers, track, header, metadata) 682 # use dummy tracker, which will be done immediately 683 tracker = DONE --> 684 stream.send_multipart(to_send, copy=copy) 685 686 if self.debug: AttributeError: 'NoneType' object has no attribute 'send_multipart' ------------------------------------------------------------------------------- I am uncertain of how to go about fixing this issue, any suggestions? I am also running on macOS Sierra. I'm not sure if this is the root of the issue or not. Thanks!
has2k1 commented 7 years ago

Thanks for reporting this. It appears to be an issue caused by a recent metakernel upgrade. Specifically version 0.18.0. Meanwhile, you can use pip install metakernel==0.17.4 to get the lastest version of metakernel that does not break the %%gnuplot magic.