<div class="gmail_quote">On 15 August 2011 18:59, Darren Govoni <span dir="ltr"><<a href="mailto:darren@ontrenet.com">darren@ontrenet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":ze">ip = InteractiveShellEmbed()<br>
<br>
I viewed the online docs for it, but it didn't show how to do this<br>
programmatically.</div></blockquote></div><br>To run pure Python code in the interactive namespaces, "ip.ex(code)" should work. To run code as if it was entered at the prompt (translating magic functions, saving as a history entry, increasing prompt count), use "ip.run_cell(code)". In the latter case, code needs to be a string, not a compiled code object.<br>
<br>There may also be a way using config to run code as the shell starts up, but I'm not sure if that works for embedding.<br><br>Thomas<br>