<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 21, 2015 at 7:35 PM, Andrew Payne <span dir="ltr"><<a href="mailto:andy@payne.org" target="_blank">andy@payne.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On getting iTorch working with IPython 3.0:<br><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><p style="margin:1.2em 0px!important"><font color="#0000ff">I didn’t play with it too much, but I submitted a <a href="https://github.com/facebook/iTorch/pulls?q=is%3Apr+author%3Aminrk" target="_blank">couple of PRs</a> to get iTorch working with IPython 3.0 last week. After those, it seemed to be working for me.</font></p></div></div></blockquote></span><div>I've dug into this more deeply and now I'm wondering how you got it working.</div><div><br></div><div>The iTorch kernel uses kernel messaging v4 (properly reported after your PR). It uses 'pyout' messages to send stdout.</div><div><br></div><div>When sending the messages, iTorch copies the header from the received message, including whatever 'version' field is in there.  See:  <a href="https://github.com/facebook/iTorch/blob/master/IOHandler.lua#L73" target="_blank">https://github.com/facebook/iTorch/blob/master/IOHandler.lua#L73</a></div><div><br></div><div>IPython 3 seems to send execute_request messages with it's current version setting, 5.0.  This causes iTorch to reply with a 'pyout' message tagged as version 5.0.  Which in turn, causes IPython to skip adapting the message to v5 (since it already thinks it's v5, in kernel/adapter.py).  And since 'pyout' is not in v5, it dropped the message on the floor.</div></div></div></div></blockquote><div><br></div><div>This is caused by a problem in how iTorch builds message headers from copies of the parent header, which it shouldn't do. I fixed most of these in <a href="https://github.com/facebook/iTorch/pull/19">#19</a>, but apparently not all of them.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>(I've opened a PR to fix this in iTorch by always setting the version to 4.0, see:  <a href="https://github.com/facebook/iTorch/pull/28" target="_blank">https://github.com/facebook/iTorch/pull/28</a>)</div><div><br></div><div>However, it raises questions:</div><div><ul><li>Should IPython be sending v5 messages to a kernel that advertises v4?<br></li></ul></div></div></div></div></blockquote><div><br></div><div>No, it shouldn't be, other than the initial kernel_info_request, which is kept compatible with v4 because it is used to determine the protocol version implemented by the kernel. After that reply is handled, the version adaptation should be preventing this.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><ul><li><br></li><li>Should the kernel messaging code be more verbose (log.warn, or something) when it gets a message type it doesn't understand?</li></ul></div></div></div></div></blockquote><div>For message *type* yes, for message *version*, probably, but I'm not sure.</div><div><br></div><div>-MinRK</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>-andy</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div></div>