[EMAIL PROTECTED] a écrit : > Hi all, > is it possible to enter an interactive session and automatically > do some initialization? > I explain better: > I want that when I start interactive Python on a console (I use Linux) > two command lines be executed automatically:
[EMAIL PROTECTED] bruno $ python -h (snip) Other environment variables: PYTHONSTARTUP: file executed on interactive startup (no default) (snip) > Python 2.3.4 (#2, Aug 19 2004, 15:49:40) > [GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>>>import sys >>>>x01=x02=0 > > > I would like not to have to write anything at the prompt >>> to run > the two commands, but be ready to start the interactive session. > Bye. [EMAIL PROTECTED] bruno $ cat ~/.pythonrc.py import sys x01=x02=0 [EMAIL PROTECTED] bruno $ export PYTHONSTARTUP=~/.pythonrc.py [EMAIL PROTECTED] bruno $ python Python 2.4.1 (#1, Jul 23 2005, 00:37:37) [GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> sys <module 'sys' (built-in)> >>> x01 0 >>> x02 0 >>> Easy as pie !-) HTH Bruno -- http://mail.python.org/mailman/listinfo/python-list