Дублировать исключение ввода

import java.lang.Exception
try:
    #Your insert statement here
except Exception, e:
	# Catches any python errors
except java.lang.Exception, e:
    #SQL Integrity errors come as Java errors so you need java.lang.Exception
    if "Duplicate entry" in str(e.cause):
        #Do something to let user know its a duplicate
Blushing Booby