When I follow the docs' guidance on exception handling, a NotSupportedError contains a string, not the expected cx_Oracle._Error object. Below is a short script that reproduces the issue. I'm using a dict as an example variable, but any unsupported variable type will throw this error.
from __future__ import print_function import cx_Oracle connection = cx_Oracle.Connection("cx_Oracle/dev@localhost/orcl") cursor = connection.cursor() my_dict = {"foo": 1, "bar": 2} try: stmt = cursor.prepare("SELECT dummy FROM dual WHERE dummy = :myvar") cursor.execute(stmt, {"myvar": my_dict}) except cx_Oracle.DatabaseError as exc: print(str(type(exc))) # <class 'cx_Oracle.NotSupportedError'> print(repr(exc)) # NotSupportedError('Variable_TypeByValue(): unhandled data type dict',) error, = exc.args # "error" is a str, NOT a cx_Oracle._Error object print("Oracle-Error-Code:", error.code) # AttributeError: 'str' object has no attribute 'code' print("Oracle-Error-Message:", error.message)
The documentation states:
EnvironmentWith cx_Oracle every exception object has exactly one argument in the
args
tuple. This argument is acx_Oracle._Error
object...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4