[IPython-user] startup file

fred fredmfp@gmail....
Mon Apr 28 10:38:24 CDT 2008


I would like to execute the following script at startup:

import __builtin__
import sys

def display_init(o):
      if o is None: return
      __builtin__._ = None
      print o
      __builtin__._ = o

sys.displayhook = display_init

I put the following line

execfile ~/.display_init.py

in my ipy_user_conf.py
but that does not work.

I set the shell variable PYTHONSTARTUP to ~/.display_init.py
If I run python, it does work:
Python 2.5.2 (r252:60911, Apr  7 2008, 01:11:55)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> 17.5/100*3.5

But if I run ipython, it still fails:
marsu[17:36:31]:~/.ipython/{1}/> 17.5/100*3.5
                          Out[1]: 0.61249999999999993

Any clue ?




More information about the IPython-user mailing list