[python-win32] odbc exceptions
Preston Landers
planders at gmail.com
Tue Nov 30 18:25:35 CET 2010
That's strange. I don't get that under Python 2.6.5 and PyWin32 v214. I get
the kind of error one would expect.
>>> try:
... odbc.odbc("asdf")
... except:
... raise
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
dbi.opError: [Microsoft][ODBC Driver Manager] Data source name not found and
no default driver specified in LOGIN
However when my organization migrated from Python 2.1 using the odbc module
to Python 2.6, we ended up switching to the PyODBC module for various
reasons including enhanced support for different data types and so far we
have been very pleased with that choice. It did take a bit of work to
change to a slightly different API, and we ran into a couple of relatively
minor corner-case bugs in PyODBC, but since we got those ironed out it has
performed very well. The PyODBC team also fixed all the issues we reported
to them. It is compiled C++ code and runs faster than a pure-Python library
would.
http://pyodbc.sourceforge.net/
regards,
Preston
On Tue, Nov 30, 2010 at 9:28 AM, Robin Becker <robin at reportlab.com> wrote:
> I don't know if the odbc module is deprecated, but I'm seeing this
> strangeness
>
> C:\code\rlextra\examples\graphics>cat toad.py
> try:
> import odbc
> print odbc.__file__
> conn = odbc.odbc('not_a_db_path')
> except:
> raise
>
> C:\code\rlextra\examples\graphics>toad.py
> C:\Python26\lib\site-packages\win32\odbc.pyd
> Traceback (most recent call last):
> File "C:\code\rlextra\examples\graphics\toad.py", line 6, in <module>
> raise
> TypeError: exceptions must be classes or instances, not str
>
> C:\code\rlextra\examples\graphics>
>
> so I guess odbc must be raising a string exception
> --
> Robin Becker
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20101130/4d43e7de/attachment-0001.html>
More information about the python-win32
mailing list