pyodbc with SQLObject

56 views
Skip to first unread message

Joe

unread,
Jan 6, 2009, 3:53:25 PM1/6/09
to pyodbc
I'm currently hacking in SQLObject (version 0.11dev) and trying to use
the MSSqlConnection capability. Currently SQLObject supports pymssql
and adobbapi, and when adding pyodbc to the mix, everything works up
until the point the connection has to be closed:

File "/usr/lib/python2.4/site-packages/SQLObject-0.11dev-py2.4.egg/
sqlobject/dbconnection.py", line 251, in _runWithConnection
self.releaseConnection(conn)
SystemError: 'finally' pops bad exception

At the moment I'm using this with corporate software but if necessary
I can look at getting a clean testbed and providing more details.

I'd really like to use pyodbc with SQLObject - they're a perfect match
for what I'm trying to do.

Joe

Ramiro Morales

unread,
Jan 6, 2009, 4:15:24 PM1/6/09
to pyo...@googlegroups.com

Are you using Python 2.4?. If so and if you can, try using Python 2 5?.

The problem you report existed as a ticket in the old Source Forge bug
tracker and the last discoverings made were that it was an error that
affected only pyodbc 2.0.5x and 2.0.6x versions running under Python
2.4.

If you can't move away from 2.4 you could try the following:

I had pasted a patch for these versions of pyodbc created from the
comments posted to that ticket by people that knows a lot more about the
Python C API to than I do:

http://pastebin.com/f42c2a3e7

Luckily I could recover the link to pastebin from one of the comments
posted at django-pyodbc issue 17:

http://code.google.com/p/django-pyodbc/issues/detail?can=1&id=17

as no trace of the pyodbc project remains on SourceForge and the issue
hasn't (yet) been ported to the new issue tracker at Google code.

A very strange problem if you ask me, I've searched the Python 2.5
changes documents trying to find something that could explain this
without success.

HTH,

--
Ramiro Morales

Joe

unread,
Jan 6, 2009, 4:33:07 PM1/6/09
to pyodbc
Thank you very much - I am using 2.4.3 but an upgrade to 2.5.1
probably wouldn't hurt. As a workaround I removed the try: finally:
in the guts of SQLObject and got things going - it turned out there
indeed was an invalid SQL statement, but it was constraints on the
server (there was no autoincrement supplied to the primary key).

I'm going to upgrade to 2.5.1 anyway and see if I can again bust
things a bit to see if things are resolved.

Indebted,
Joe

On Jan 6, 3:15 pm, "Ramiro Morales" <cra...@gmail.com> wrote:
>  Ramiro Morales- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages