470,581 Members | 2,433 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

PYTHONSTARTUP and the -i command line option


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
Jul 19 '05 #1
2 1820
Christopher Wood wrote:
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?


Modifying the contents of your .pythonrc script and therein setting the
PYTHONINSPECT environment variable via os.environ comes to mind.

-Peter
Jul 19 '05 #2
After entering the interpreter, you could do an execfile on the
..pythonrc file.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Rhino | last post: by
4 posts views Thread by Todd Acheson | last post: by
8 posts views Thread by 4.spam | last post: by
13 posts views Thread by Pieter Edelman | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.