confirm_exit issue with scipy profile...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

confirm_exit issue with scipy profile...

fred-87
Hi all,

I have set

confirm_exit 0

in my ipythonrc file.

So I type Ctrl+D in ipython, it exits
as expected.

But if I use the scipy profile

ipython -p scipy,

confirmation is asked when I want to exit.

Any clue ?

TIA.

Cheers,

PS: my ipythonrc-scipy file only contains

include ipythonrc

# import ...
# Load SciPy by itself so that 'help scipy' works
import_mod scipy

# from ... import ...
from scipy.io.numpyio import fread, fwrite

# Now we load all of SciPy
# from ... import *
import_all scipy

# code
execute print 'Welcome to the SciPy Scientific Computing Environment.'

PS2: I use svn #2635.

--
http://scipy.org/FredericPetit


_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

fred-87
fred a écrit :

Oops, sorry.

Too tired...

--
http://scipy.org/FredericPetit

_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Ville M. Vainio
In reply to this post by fred-87
On 8/17/07, fred <[hidden email]> wrote:

> Hi all,
>
> I have set
>
> confirm_exit 0
>
> in my ipythonrc file.

No time to explore right now, but your best bet is to put this in
ipy_user_conf.py instead.

--
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Fernando Perez
On 8/16/07, Ville M. Vainio <[hidden email]> wrote:

> On 8/17/07, fred <[hidden email]> wrote:
>
> > Hi all,
> >
> > I have set
> >
> > confirm_exit 0
> >
> > in my ipythonrc file.
>
> No time to explore right now, but your best bet is to put this in
> ipy_user_conf.py instead.
>

There's a bug in priorities, because it's possible that the new
ipy_profile_scipy profile is overriding the one in Fred's home dir.
Data/configs in the user's directory should always override
system-provided ones.

Currently, the new system-side scipy profile is overriding Fred's, and
not properly loading the base one.  That's a bug in the new system to
load profiles, which will hopefully be fixed soon:

http://projects.scipy.org/ipython/ipython/ticket/177

Cheers,

f
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Ville M. Vainio
On 8/17/07, Fernando Perez <[hidden email]> wrote:

> > > I have set
> > >
> > > confirm_exit 0
> > >
> > > in my ipythonrc file.
> >
> > No time to explore right now, but your best bet is to put this in
> > ipy_user_conf.py instead.
> >
>
> There's a bug in priorities, because it's possible that the new
> ipy_profile_scipy profile is overriding the one in Fred's home dir.
> Data/configs in the user's directory should always override
> system-provided ones.
>
> Currently, the new system-side scipy profile is overriding Fred's, and
> not properly loading the base one.  That's a bug in the new system to
> load profiles, which will hopefully be fixed soon:

I'm not sure I want to fix this.

The deal is, we don't typically want profiles in ~/_ipython, but let
them stay in Extensions. The profile in itself should be as
"functional" out of the box as possible, and the user should be
content in doing their settings/customization in ipy_user_conf.py (or
add a new profile that imports the old profile and specializes it).

The particular issue with scipy profile is that it does "import
ipy_defaults", which sets the "sensible" default values for many
variables (i.e. what ipythonrc was basically doing). "ipythonrc"
should not override them. My guess is that there is no "scipy" profile
in fred's ~/_ipython (and hence no "include ipythonrc" that it came
with), they are not installed anymore (but are honored if they do
exist).

The change I *will* probably put in (and that will take care of
backwards compatibility) is:

- If ipythonrc-PROFILE is found, do not import ipy_profile_PROFILE

ipythonrc-PROFILE files still will not be installed to ~/_ipython,
this feature is retained for backwards compatibility on/y (i.e. for
people w/ existing profile files they do not want to convert over to
the new system).

--
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Ville M. Vainio
> should not override them. My guess is that there is no "scipy" profile
> in fred's ~/_ipython (and hence no "include ipythonrc" that it came

Ok, that was a bad guess. But nevertheless, this will be fixed by my
stated plan - though what we really need to fix is the docs.

--
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Hans Meine
In reply to this post by Ville M. Vainio
BTW: My (stock) ip_profile_sh already says:
> # The import below effectively obsoletes your old-style ipythonrc[.ini],
> # so consider yourself warned!
>
> import ipy_sane_defaults

On Montag 20 August 2007, Ville M. Vainio wrote:
> ipythonrc-PROFILE files still will not be installed to ~/_ipython,
> this feature is retained for backwards compatibility on/y (i.e. for
> people w/ existing profile files they do not want to convert over to
> the new system).
FWIW, I mostly prefer the old ipythonrc files -- I am only using import_mod
and import_all (and import_some) anyways.

import_mod is easy to replace with a real import without getting much longer,
but import_all is a very convenient shortcut.

And -- please point out if I missed something -- although I would occasionally
like to run arbitrary python code *in the user namespace*, the new config
files need me to wrap it in string quotes for ip.ex(), no?
(Losing syntax highlighting, automatic indentation etc. in my editor..)

--
Ciao, /  /                                                    .o.
     /--/                                                     ..o
    /  / ANS                                                  ooo

_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Ville M. Vainio
On 8/21/07, Hans Meine <[hidden email]> wrote:

> BTW: My (stock) ip_profile_sh already says:
> > # The import below effectively obsoletes your old-style ipythonrc[.ini],
> > # so consider yourself warned!
> >
> > import ipy_sane_defaults

Ok, that's probably an old version. It has been called ipy_defaults for a while.

> FWIW, I mostly prefer the old ipythonrc files -- I am only using import_mod
> and import_all (and import_some) anyways.
>
> import_mod is easy to replace with a real import without getting much longer,
> but import_all is a very convenient shortcut.

Yeah, the benefits of the new config files mostly become apparent with
less trivial cases. Of course you could add

def import_all(m): ip.ex('from %s import *' % m)

to the beginning of the file yourself.

> And -- please point out if I missed something -- although I would occasionally
> like to run arbitrary python code *in the user namespace*, the new config
> files need me to wrap it in string quotes for ip.ex(), no?
> (Losing syntax highlighting, automatic indentation etc. in my editor..)

Of course you can still put stuff in modules, and import them with ip.ex.

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.

--
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Hans Meine
Am Dienstag, 21. August 2007 09:17:24 schrieben Sie:
> Yeah, the benefits of the new config files mostly become apparent with
> less trivial cases.
I noticed that.  I just wanted to point this out (again), so maybe the trivial
cases can get better support.

> Of course you could add
>
> def import_all(m): ip.ex('from %s import *' % m)
>
> to the beginning of the file yourself.

That's a good idea.  But wouldn't it be nice to provide this function in
ipython itself?  Maybe extended like this:

def import_all(*modules):
  for m in modules:
    ip.ex('from %s import *' % m)

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")

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

> > And -- please point out if I missed something -- although I would
> > occasionally like to run arbitrary python code *in the user namespace*,
> > the new config files need me to wrap it in string quotes for ip.ex(), no?
> > (Losing syntax highlighting, automatic indentation etc. in my editor..)
>
> Of course you can still put stuff in modules, and import them with ip.ex.
>
> 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.

Reciting you from above:
> 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 simply
import'ed, right?  Hmm, I see no nice (and backwards-compatible),
non-complicated way of differentiating between the two namespaces then. :-(

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.

Nice greetings,
  Hans
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Ville M. Vainio
On 8/21/07, Hans Meine <[hidden email]> 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'
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: confirm_exit issue with scipy profile...

Hans Meine
In reply to this post by Hans Meine
[Sending this again due to wrong sender address (did not receive any error
though)..  Thanks Ville for your answer, I am sorry that this mail did not
make it to the list in time!]

Am Dienstag, 21. August 2007 11:17:47 schrieb Hans Meine:
> 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!

I have to correct myself - I did not actually save the ipy_handy_utils.py ;-/

So this is a viable solution for me - I can then call my modules
ipy_profile_foo_userspace.py and import them with that name.

Now it's all a matter of nice, *simple* examples in the default installation.  
Recently (0.8.1), I still got mostly old examples:

-rw-r--r--  1 meine bvp  6582 May  4 22:01 ipy_profile_sh.py
-rw-r--r--  1 meine bvp  1279 May  4 22:01 ipy_user_conf.py
-rw-r--r--  1 meine bvp  1025 Aug 21 11:21 ipy_user_conf.pyc
-rw-r--r--  1 meine bvp 24168 Aug 21 11:21 ipythonrc
-rw-r--r--  1 meine bvp  1345 Aug 21 11:21 ipythonrc-math
-rw-r--r--  1 meine bvp  2138 Aug 21 11:21 ipythonrc-numeric
-rw-r--r--  1 meine bvp  1603 Aug 21 11:21 ipythonrc-physics
-rw-r--r--  1 meine bvp  3602 Aug 21 11:21 ipythonrc-pysh
-rw-r--r--  1 meine bvp  1266 Aug 21 11:21 ipythonrc-scipy
-rw-r--r--  1 meine bvp  1260 Aug 21 11:21 ipythonrc-tutorial

If these were converted to the new syntax, more people would probably use it.

Ciao, /  /
     /--/
    /  / ANS
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev