[IPython-dev] IPython prompt delay

Stefan van der Walt stefan at sun.ac.za
Thu Dec 1 07:13:02 EST 2005


While looking at your problem I found another:

$ ipython -prompt_in1 | some_nonexisting_program

*boom*

In the manpage, it describes the input option as

-prompt_in1|pi1 <string>

which I find rather confusing.  Like

-no|banner

which clearly means -[no]banner, the options above looked more like

-promp_in1 or -prompt_pi1 to me.

After figuring that I had to use the -pi1 option, I tried

$ ipython -pi1 \$\{ }

*crash*

OK, so looks like I'm not going to be able to test this, but try
something like

argv = ["-pi1", "${mysleep = lambda t: return str(time.sleep(t))*0; mysleep(0.2)}PyMAD>>> ",
        "-po", " ",
        "-profile", "pymad"]

This will define mysleep every time the prompt comes up -- but since
you want a delay anyway, this won't matter :)

Cheers
Stéfan

On Wed, Nov 30, 2005 at 11:05:58AM -0700, Fernando Perez wrote:
> Frédéric Mantegazza wrote:
> > Le Mardi 29 Novembre 2005 21:08, Fernando Perez a écrit :
> > 
> > 
> >>The prompt system is fully dynamic, so the easiest way is to insert a
> >>time.sleep() call into your prompt :)
> > 
> > 
> > You mean like this :
> > 
> > argv = ["-pi1", "${time.sleep(0.2)}PyMAD>>> ",
> >         "-po", " ",
> >         "-profile", "pymad"]
> > ipshell = IPShellEmbed(argv)
> > 
> > It works, but it displays 'None' before PyMAD. It is because time.sleep() 
> > returns None, I presume. How can I make it return an empty string, 
> > instead ?
> 
> Wrap it:
> 
> def mysleep(t):
>    time.sleep(t)
>    return ''
> 
> Cheers,
> 
> f




More information about the IPython-dev mailing list