PYTHONSTARTUP and the -i command line option

Christopher Wood cpw28 at cam.ac.uk
Thu Jun 2 10:53:00 EDT 2005


Greetings all,

A quick query: as all sorts of stuff can be defined in a .pythonrc.py 
file or similar and called at python startup using the PYTHONSTARTUP 
environment variable, it's very useful and can enhance the interpreter 
experience greatly.

However, executing a script using the -i command line option to put the 
Python interpreter into 'interactive mode' after script termination is 
also very useful.

But these two things won't play together, as (by design, it seems) 
$PYTHONSTARTUP isn't read when the -i option is used, leaving me with an 
unenhanced Python interpreter environment after after script execution.

Is the any way round this, other than editing all my scripts or manually 
loading the .pythonrc.py script in the interpreter?

Thanks in advance for any hints!

Chris Wood



More information about the Python-list mailing list