PYTHONSTARTUP ignored by python -i file.py?
Huaiyu Zhu
hzhu at users.sourceforge.net
Wed Sep 13 19:58:28 EDT 2000
On 13 Sep 2000 16:59:33 -0400, David M. Cooke <cookedm at physics.mcmaster.ca>
wrote:
>from the man page:
>
> -i When a script is passed as first argument or the -c
> option is used, enter interactive mode after exe
> cuting the script or the command. It does not read
> the $PYTHONSTARTUP file. This can be useful to
> inspect global variables or a stack trace when a
> script raises an exception.
Wouldn't it be a good idea to have two options, one for whether it's
interactive, and one for whether to read startup file, with sensible
defaults of the latter depending on the former?
>> How do I achieve both results (.pythonrc and file.py) with one command line?
>
>You could try this:
>
>python -i -c "execfile('$PYTHONSTARTUP'); from file import *"
>
>but then it's probably easier to type
>python
>>>> from file import *
Yeah, I'll stick with the latter. :-(
Huaiyu
More information about the Python-list
mailing list