[Idle-dev] auto-loading at shell start and shell restart
Mark Summerfield
M.N.SUMMERFIELD.405728 at swansea.ac.uk
Fri Feb 24 09:30:31 CET 2006
On Friday 24 February 2006 00:18, Noam Raphael wrote:
> Hello,
>
> You can try to set the environment variable PYTHONSTARTUP to a file
> with all those lines that you always run when you start working. It
> should work fine with Python-in-a-terminal - perhaps you should test
> it first.
>
> IDLE should run those commands on startup, if given the -s flag. It
> doesn't re-run it if you restart the shell. I worked with a friend of
> mine on fixing this, and perhaps I'll post it as a patch.
Thanks for the advice. I put the two lines in a file and used the -s
option having set $IDLESTARTUP, and then again using $PYTHONSTARTUP. In
both cases the
from math import *
line worked correctly, but the
from __future__ import division
line was ignored.
> On 2/17/06, Mark Summerfield <M.N.SUMMERFIELD.405728 at swansea.ac.uk> wrote:
> > Hi,
> >
> > I love using IDLE, both for experimenting with python and for
> > calculations.
> >
> > But every time I start IDLE for calculations I have to type in:
> >
> > from __future__ import division
> > from math import *
> >
> > which would be bearable if I only had to do it once a day... but when I
> > experiment I often have my code in a separate python file, so I do:
> >
> > import mycode
> >
> > then do my experiments, then, when I've hit problems or want to move
> > forward, I do Shell|Restart, and use ^P a few times to get the import
> > line back. Which is fine, except that if I've done a lot between imports
> > and I want to switch between testing mycode.py and some calculations I
> > end up having to type
> >
> > from __future__ import division
> > from math import *
> >
> > time after time.
> >
> > I wish there was some standard way (i.e. in Options) of having a list of
> > python commands to issue whenever the shell is started or restarted.
> >
> > Regards.
> >
> > --
> > Mark Summerfield
> >
> > _______________________________________________
> > IDLE-dev mailing list
> > IDLE-dev at python.org
> > http://mail.python.org/mailman/listinfo/idle-dev
--
Mark Summerfield
More information about the IDLE-dev
mailing list