[IPython-user] python vs. ipython

Glen W. Mabey Glen.Mabey at swri.org
Tue Oct 25 12:50:27 CDT 2005

On Tue, Oct 25, 2005 at 10:47:25AM -0600, Fernando Perez wrote:
> The easiest way to think of it is simply that you start ipython _once_, and 
> then use
> run yourscript.py --option1 --option2 arg1 arg2
> as many times as needed, as you make changes (typically in an editor open in 
> another window) to yourscript.py.  Everytime yourscript.py runs, is similar to 
> making a call to
> python -i yourscript.py ...
> but without having to fully reload all modules from scratch (which for large 
> and complex modules can be O(minutes) ).  
> You need to be careful if yourscript imports things which you are also 
> modifying, due to the nature of python's import statement.  There have been 
> discussions in the past on this topic.

Frequently I find myself in precisely this scenario: I'm editing a class
that is imported by the script that I'm running.  Hence, I have to exit
ipython in order to get the newer version loaded.  

For my purposes, it would be very convenient if there were a
command-line option to specify a script to %run immediately after
ipython has started.  Something like:

    ipython -run yourscript.py

Ideally, as soon as the script finishes, the user would be returned back 
to the ipython prompt, to then be able to access the environment produced 
by the script.

Is there some way to do that?  The -c option doesn't really work this way, 
to my understanding.  This seems to especially be the case when the
-qthread switch is also used.

Glen Mabey

More information about the IPython-user mailing list