Provide a -run option for interactive use

Bug #458228 reported by Eero Aaltonen
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
IPython
Fix Committed
Undecided
Unassigned

Bug Description

This is a feature proposal for using ipython -pylab

I'm doing scientific analysis and I would like to start pylab with my dataset definitions and scripts loaded to the interactive namespace. I've put my dataset definitions in definitions.py

Running
ipython -pylab definitions.py

will execute everything, but my definitions do not show up with %who

Running
ipython -pylab -c "%run defs.py"

will execute the interpreter.

I propose that either
ipython -pylab definitions.py
is altered such that the definitions are listed in %who

or that you add a -run option, so that the effect can be achieved by executing
ipython -pylab -run definitions.py

Revision history for this message
Eero Aaltonen (ejn) wrote :

Running
ipython -pylab -c "%run defs.py"

will *exit* the interpreter.

damn typo

Revision history for this message
olle! (kungenenaken) wrote :

Second.

It seems the functionality of the "-c" option changed somewhere between 0.8.1 and 0.8.4. In 0.8.1 you can do

ipython -c "print 5"

and the interpreter stays alive after printing 5. In 0.8.4 the interpreter quits.

I strongly suggest adding a -run option to mimic the old -c. Until then, I will stay with 0.8.1...

Revision history for this message
Fernando Perez (fdo.perez) wrote :

Now the -i option lets you ask for the interpreter to stay interactive:

amirbar[junk]> ipython -i -c 'x=10;print x**3'
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
Type "copyright", "credits" or "license" for more information.

IPython 0.11.alpha1.bzr.r1223 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
1000

In [2]:

So all you need to do is add -i to your calls, and we have a -c that matches the default Python behavior.

The above is the current trunk behavior.

Changed in ipython:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.