<br><br><div class="gmail_quote">On Thu, Jun 14, 2012 at 3:57 PM, Jonathan Taylor <span dir="ltr"><<a href="mailto:jonathan.taylor@stanford.edu" target="_blank">jonathan.taylor@stanford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>Thanks, that seems to work in a separate python process rather than the ipython process:<br></div><div><br></div><div>~/workbook (metadata*) $ python -c "import IPython.frontend.terminal.interactiveshell as IS; shell = IS.TerminalInteractiveShell(); shell.run_cell('%load_ext rmagic'); shell.run_cell('%R X=rnorm(20); print(X)')"</div>


<div> [1]  0.2125483  0.1030451 -1.4036373 -0.5617847 -0.7571675 -0.3985085</div><div> [7] -0.4386932  0.7164915 -0.4794236 -0.1373804  0.2831013 -0.7248862</div><div>[13]  0.5260675 -0.3789804  0.1535592  1.5569203  1.0225972  0.8149846</div>


<div>[19] -0.9629060 -0.4161373</div><div><br></div><div>~/workbook (metadata*) $ python -c "import IPython.frontend.terminal.interactiveshell as IS; shell = IS.InteractiveShell(); shell.run_cell('%load_ext rmagic'); shell.run_cell('%R X=rnorm(20); print(X)')"</div>


<div> [1]  0.44037484  1.31372601 -0.37253955  2.21955270 -0.07886852 -0.09022193</div><div> [7]  0.38464850 -0.41004855  1.62648041 -0.13687832  0.91537699 -2.70125217</div><div>[13]  1.49125226  0.11580012 -0.64993087  2.49367657  0.01447792  0.57408249</div>


<div>[19] -0.80559871 -0.76346964</div><div><br></div>So, for interactively running this in ipython I should expect to see this load_ext failure?<div><br></div></blockquote><div><br></div><div>You are running into some singleton assumptions in the new magics system - each Magics class methods are only registered once, and thus bound to the first Shell that load the magic.</div>

<div><br></div><div>So what you are seeing is that shell.magic("load_ext rmagic") is actually triggering the load_ext magic on the *original* IPython instance.  I think this should be considered a bug.</div><div>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div><div>Thanks,</div><div><br></div><div>Jonathan</div><div><div><div class="h5"><br>
<div class="gmail_quote">On Thu, Jun 14, 2012 at 3:48 PM, Thomas Kluyver <span dir="ltr"><<a href="mailto:takowl@gmail.com" target="_blank">takowl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>On 14 June 2012 23:44, Jonathan Taylor <<a href="mailto:jonathan.taylor@stanford.edu" target="_blank">jonathan.taylor@stanford.edu</a>> wrote:<br>
> Actually, I want to create an InteractiveShell inside another python<br>
> process. Maybe I should use embed?<br>
<br>
</div>Embed's not terribly relevant here - that creates an InteractiveShell,<br>
but attempts to use the namespace from which it's called.<br>
<br>
Try it in a separate Python process. Don't forget to %load_ext rmagic first.<br>
<span><font color="#888888"><br>
Thomas<br>
</font></span><div><div>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">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>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><div class="im">-- <br>Jonathan Taylor                          <br>Dept. of Statistics                      <br>Sequoia Hall, 137                          <br>

390 Serra Mall<br>
Stanford, CA 94305<br>Tel:   <a href="tel:650.723.9230" value="+16507239230" target="_blank">650.723.9230</a><br>Fax:   <a href="tel:650.725.8977" value="+16507258977" target="_blank">650.725.8977</a><br>Web: <a href="http://www-stat.stanford.edu/~jtaylo" target="_blank">http://www-stat.stanford.edu/~jtaylo</a><br>


</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>