[IPython-dev] Dynamically changing the prompt from within a magic

David Quigley dpquigl at davequigley.com
Fri Aug 3 12:44:33 EDT 2012

I have been reading the dynamic prompt cookbook entry found at 
http://wiki.ipython.org/Cookbook/Dynamic_Prompt and it seems from the 
description that all of that work is done in the profile. I'm trying to 
figure out if there is a way to do this in a magic. I have a magic 
called prompt where if nothing is passed in it will print the format 
string for the prompt otherwise it will take the string save it off and 
apply it to the config structure passed into the class.

I get the config entry during the __init__ call for my plugin class and 
pass it into the class I'm implementing the magic in. Once there I save 
it off and then use it later in the magic. The problem I'm having is 
that 1) unless I set the config.PromptManager.in_template field first it 
doesn't exist (no default?) and 2) when I do set that value it doesn't 
actually change the prompt.

Is there something that I'm missing here?

More information about the IPython-dev mailing list