Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValueError: unsupported format character '{' (0x7b) in defining dictionary

Tags:

python

I'm writing some code for web development using Google Python Appengine. In my code I have to concatenate strings using % and dictionary Here's the code I've written.

def print_form(self, unameError='', passwdError='', verpasswdError='', emailError='', unameValue='', emailValue='' ):
    self.response.out.write( form3 % {  "unameError"    : unameError, 
                                        "passwdError"   : passwdError, 
                                        "verpasswdError": verpasswdError, 
                                        "emailError"    : emailError, 
                                        "unameValue"    : unameValue,  
                                        "emailValue"    : emailValue
                                     }  
                            )

For this code, I'm receiving this error from server :

web-app-local-directory-path/main.py", line 139, in print_form "emailValue" : emailValue ValueError: unsupported format character '{' (0x7b) at index 218

I can't seem to figure out what is wrong in this code. I've defined a valid dictionary and there seem to be no problem with it according to me.

Somebody please help me on this.

Regards Vaid, Abhishek

like image 336
VaidAbhishek Avatar asked May 17 '12 17:05

VaidAbhishek


1 Answers

It sounds like you may have the sequence "%{" in the value of form3.

like image 178
the paul Avatar answered Oct 05 '22 23:10

the paul