Is this the preferred way to detect if the unicode or non-unicode version of cx_oracle was installed?

StackOverflow https://stackoverflow.com/questions/4961707

  •  12-11-2019
  •  | 
  •  

I have a custom module that's basically a thin wrapper around a database connection with cx_Oracle. I'd like to re-use this module on computers with both the unicode version of cx_Oracle installed, and with the non-unicode version.

To do this, I need to "detect" the version installed. I could "try" making a connection using a string connection descriptor; and if I get a TypeError back, then assume it's the unicode version installed. This just seems a bit kludgy.

Is there a better/preferred way of doing this?

Thanks.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top