Hi, I want to catch Exception Bad Request, I have Python Script with parametr id_con: id_con='con_'+log str_con = log+'/'+dbpassw+ '@ora9cip' try: container.manage_addZOracleConnection(id_con,'',str_con,check=1, REQUEST=None) except: return "ERROR" else: return id_con in Handling Exception I want to catch Exception Bad Request, I get this message always when I try to add new connection, that already exist, this code above catch all Exception unfortunatelly, I ask for help, thanks®ards, Adam
<snip> From: hawelek_tlen I want to catch Exception Bad Request, try: container.manage_addZOracleConnection(id_con,'',str_con,check=1, REQUEST=None) except: return "ERROR" else: return id_con in Handling Exception I want to catch Exception Bad Request, I get this message always when I try to add new connection, that already exist, this code above catch all Exception unfortunatelly, </snip> You need to include the error condition that you want to trap in the 'except' statement: eg try: some code except ValueError: handle value error except IOError: handle io error except: handle all other errors HTH Jonathan
Small Business Services wrote:
except: handle all other errors
NEVER have bare excepts in Zope, much pain and suffering is to be had there... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (3)
-
Chris Withers -
hawelek_tlen -
Small Business Services