[newbie] - How to remain at prompt after script execution?

Amit Dhingra mechanicalamit at yahoo.co.uk
Mon Feb 14 12:55:31 EST 2005


Thanx Fredrik, that works and thats what I wanted.

Amit

"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:mailman.2551.1108402459.22381.python-list at python.org...
> Amit Dhingra wrote:
>
> > I would like to excute a script and upon completion, how can I just a
python
> > prompt with the functions and variables already defined.
> >
> > I know you can do this in the window gui(IDLE). I was wondering if this
can
> > be done in POSIX systems as well.
>
> does "python -i" do what you want?
>
> $ python -h
> usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
> Options and arguments (and corresponding environment variables):
> -c cmd : program passed in as string (terminates option list)
> -d     : debug output from parser (also PYTHONDEBUG=x)
> -E     : ignore environment variables (such as PYTHONPATH)
> -h     : print this help message and exit
> -i     : inspect interactively after running script, (also
PYTHONINSPECT=x)
>          and force prompts, even if stdin does not appear to be a terminal
> ...
>
> $ more myprogram.py
> message = "hello, world"
> print messae
> $ python -i myprogram.py
> hello, world
> >>> print message.upper()
> HELLO, WORLD
>
> </F>
>
>
>





More information about the Python-list mailing list