The problem is due to how IPython allows for dynamic prompts. The prompt expression must be eval'ed in the user namespace, so you can put what you want in that prompt. But that means that the user namespace can't contain 'str' as a variable, because then doing
so if you also define 'len' to be something other than the builtin, you get a similar error.
I'm leaving these comments in here for the record, so we understand the problem better. I'm not sure it's easy to make a 100% robust dynamic prompt system, since for it to be truly dynamic you need to eval in the user's namespace arbitrary expressions, hence running into whatever funny redefinitions the user may have applied.
The problem is due to how IPython allows for dynamic prompts. The prompt expression must be eval'ed in the user namespace, so you can put what you want in that prompt. But that means that the user namespace can't contain 'str' as a variable, because then doing
str(prompt_expr)
won't work when executed in the user's namespace.
That expression is by default:
<ItplNS '${self. col_p2} .${"."* len(str( self.cache. prompt_ count)) }.: $self.col_norm' >)
so if you also define 'len' to be something other than the builtin, you get a similar error.
I'm leaving these comments in here for the record, so we understand the problem better. I'm not sure it's easy to make a 100% robust dynamic prompt system, since for it to be truly dynamic you need to eval in the user's namespace arbitrary expressions, hence running into whatever funny redefinitions the user may have applied.