On 1 Feb 2007 10:17:31 -0800, baur79 <[EMAIL PROTECTED]> wrote:
> Hi guys
>
>
> i try to run this code in loop and to pass even the entry is
> duplicated
>
> def email_insert_in_db(email):
>   sql="INSERT INTO emails (email) values ('%s') "%(email)
>   db=_mysql.connect(host = "localhost", user = db_user, passwd =
> db_pass, db = db_name)
>
>   try:
>     db.query(sql)
>   except IndentationError:
>     print "duplicate"
>     pass
>
> also try to (raise, continue)
> but can't continue in loop
>
> error output is:
>   File "inser_in_db.py", line 85, in email_insert_in_db
>     db.query(sql)
> IntegrityError: (1062, "Duplicate entry '[EMAIL PROTECTED]' for key 1")
>
> thanks for your help
>
> Baurzhan Zhakashev
> Kazakhstan / Shymkent city
>
> --

If you want to catch IntegrityError, why are you actually catching
IndentationError?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to