Assigning different Exception message

Tor Erik Soenvisen toreriks at hotmail.com
Thu Oct 12 09:08:21 EDT 2006


        try:
            self.cursor.execute(sql)
        except AttributeError, e:
            if e.message == "oracleDB instance has no attribute 'cursor'":
                e.message = 'oracleDB.open() must be called before' + \
                            ' oracleDB.query()'
            raise AttributeError, e

This code does not re-assign e's message when the conditional is satisfied. 
Why not?

regards



More information about the Python-list mailing list