[IPython-dev] confirm_exit issue with scipy profile...

Ville M. Vainio vivainio@gmail....
Tue Aug 21 06:18:24 CDT 2007


On 8/21/07, Hans Meine <hans_meine@gmx.net> wrote:

> or even:
>
> def import_all(modules):
>  for m in modules.split():
>    ip.ex('from %s import *' % m)
>
> The latter would allow writing e.g.
>
> import_all("math os numpy")

That would be ok, I guess: the ipapi already has some redundancy for
convenience, a'la to_user_ns.

> Also, one might include "from IPython import ipapi" in the namespace.

It is there. '_ip' always points to an ipapi instance in a live
IPython interpreter.

> > There is really nothing you "need" to do with the new style, apart
> > from verifying it's legal Python... and that's a good thing.
>
> Yes, it's a really good thing, but not every ipython user wants to write a
> sophisticated config file (I know a lot of people who do not even bother
> creating their own profiles, but simply execfile() their setup scripts).  It
> would simplify matters if there was an additional config API for the simple
> things.

The existing IPApi is quite simple already, as in minimal. Perhaps
what you really need is execfile?

> > Of course you can still put stuff in modules, and import them with ip.ex.
> I thought about that, yes.  But I wonder if it wouldn't be better to accompany
> each ip_profile_foo with an ipy_profile_foo_userspace which is automatically
> loaded?  Or - even better - add a special entrypoint in ipy_profile_foo.py
> for code automatically run in userspace.  Currently, the code is

ip.execfile should do that sufficiently well.

> Is .ipython in sys.path?  Apparently not.  I tried moving my code into an
> ipy_handy_utils.py and adding ip.ex("from ipy_handy_utils import *") to
> ipy_user_conf.py, but I am getting:
> > WARNING: Could not import user config!
> >  ('/home/meine/.ipython/ipy_user_conf.py' does not exist? Please run
> > '%upgrade')
> Seems to be a caught exception - obviously all ImportErrors are caught.
> AFAICS, this should be changed to check whether the failed import actually
> was ipy_user_conf itself.  I cannot check right now, because the
> ipython.scipy.org seems to be down right now.

.ipython should definitely be on sys.path. Gotta look into it later
when I have the time.

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-dev mailing list