I managed to resolve my own dilemma. For posterity, I'm going to record the solution to my dilemma here:<br> <br>If you want to run ipython commands within a python script you need to do something like<br> <br>from IPython.Shell
import IPShellEmbed<br>ipshell = IPShellEmbed()<br>ip=ipshell.IP<br> <br>and then if you have _ipmagic commands you want to run, you can do<br> <br>ip.ipmagic("px import os")<br> <br>for example.<br> <br>This is a big help when running parallel ipython1 commands.
<br><br><div class="gmail_quote">On Dec 5, 2007 10:00 AM, <<a href="mailto:ipython-user-request@scipy.org">ipython-user-request@scipy.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Send IPython-user mailing list submissions to<br> <a href="mailto:ipython-user@scipy.org">ipython-user@scipy.org</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br> <a href="http://lists.ipython.scipy.org/mailman/listinfo/ipython-user" target="_blank">
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user</a><br>or, via email, send a message with subject or body 'help' to<br> <a href="mailto:ipython-user-request@scipy.org">ipython-user-request@scipy.org
</a><br><br>You can reach the person managing the list at<br> <a href="mailto:ipython-user-owner@scipy.org">ipython-user-owner@scipy.org</a><br><br>When replying, please edit your Subject line so it is more specific
<br>than "Re: Contents of IPython-user digest..."<br><br><br>Today's Topics:<br><br> 1. non-interactive ipython for script (Reckoner)<br><br><br>----------------------------------------------------------------------
<br><br>Message: 1<br>Date: Tue, 4 Dec 2007 14:40:17 -0500<br>From: Reckoner <<a href="mailto:reckoner@gmail.com">reckoner@gmail.com</a>><br>Subject: [IPython-user] non-interactive ipython for script<br>To: <a href="mailto:ipython-user@scipy.org">
ipython-user@scipy.org</a><br>Message-ID:<br> <<a href="mailto:a1b53c580712041140r19aa9e6fg2018d9e53f563da9@mail.gmail.com">a1b53c580712041140r19aa9e6fg2018d9e53f563da9@mail.gmail.com</a>><br>Content-Type: text/plain; charset="iso-8859-1"
<br><br>I need to be able to run certain ipython magic commands using the plain<br>vanilla python interpreter.<br><br>In other words, I have an ipython script that I can certainly invoke using<br>ipython on the command line, but I need to run the script using python on
<br>the command line.<br><br>I know it has something to do with importing IPython, but I can't do the<br>IPython.Shell.start().mainloop() part since I need non-interactive running.<br><br>I hope that made some sense.
<br><br>Any help appreciated.<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20071204/e7802df1/attachment-0001.html" target="_blank">
http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20071204/e7802df1/attachment-0001.html</a><br><br>------------------------------<br><br>_______________________________________________<br>IPython-user mailing list
<br><a href="mailto:IPython-user@scipy.org">IPython-user@scipy.org</a><br><a href="http://lists.ipython.scipy.org/mailman/listinfo/ipython-user" target="_blank">http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
</a><br><br><br>End of IPython-user Digest, Vol 50, Issue 2<br>*******************************************<br></blockquote></div><br>