Hi again, I worked around the linking problem by exporting
LD_PRELOAD=/usr/lib/libct.so
before starting python. So now I can import the module and even connect
to the database, but as soon as I want to SELECT something, the
following exception is thrown:
> $ LD_PRELOAD=/usr/lib/libct.so ipython
> Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.8.4 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: import logging
>
> In [2]: logging.basicConfig()
>
> In [3]: import Sybase
>
> In [4]: Sybase.DEBUG = True
>
> In [5]: db = Sybase.connect('ara', 'DBA', 'SQL')
> DEBUG:sybase:locking
> DEBUG:sybase:unlocking
>
> In [6]: db.execute('SELECT * FROM ABONAMENT;')
> DEBUG:sybase:locking
> DEBUG:sybase:locking
> DEBUG:sybase:Cursor(163722924): execute 'SELECT * FROM ABONAMENT;' with {}
> DEBUG:sybase:locking
> DEBUG:sybase:Cursor(163722924): allocate ct_cursor
> DEBUG:sybase:unlocking
> DEBUG:sybase:unlocking
> DEBUG:sybase:unlocking
> ---------------------------------------------------------------------------
> AttributeError Traceback (most recent call last)
>
> /home/msawicz/<ipython console> in <module>()
>
> /usr/lib/python2.5/site-packages/python_sybase-0.40pre1-py2.5-linux-i686.egg/Sybase.pyc in execute(self, sql)
> 1227 try:
> 1228 cursor = self.cursor()
> -> 1229 cursor.execute(sql)
> 1230 cursor.close()
> 1231 finally:
>
> /usr/lib/python2.5/site-packages/python_sybase-0.40pre1-py2.5-linux-i686.egg/Sybase.pyc in execute(self, sql, params, select)
> 692 if DEBUG: log.debug("%r: execute %r with %r" % (self, sql, params))
> 693 if sql is not None and sql != self._sql:
> --> 694 self.prepare(sql, select=select)
> 695 else:
> 696 # Re-execute same request
>
> /usr/lib/python2.5/site-packages/python_sybase-0.40pre1-py2.5-linux-i686.egg/Sybase.pyc in prepare(self, sql, select)
> 497 # _ctx.debug_msg("using ct_cursor, %s\n" % sql)
> 498 if DEBUG: log.debug("%r: allocate ct_cursor" % self)
> --> 499 status = self._cmd.ct_cursor(CS_CURSOR_DECLARE, "ctmp%x" % id(self), sql, CS_UNUSED)
> 500 if status != CS_SUCCEED:
> 501 self._raise_error(Error('ct_cursor declare'))
>
> AttributeError: ct_cursor
>
> In [7]:
When exiting, an additional error:
> In [8]:
> Do you really want to exit ([y]/n)? y
> DEBUG:sybase:Cursor(163722924): close
> Exception exceptions.AttributeError: 'ct_cursor' in <bound method Cursor.__del__ of Cursor(163722924)> ignored
That's on both Debian Lenny and Sid, python-sybase-0.39 and -0.40pre1,
freetds-0.82, python-2.5.2 and -2.6.6, Sybase (ASA) 9.0.1.1753.
Any possible solutions? For both, actually - the linking issue and the
ct_cursor AttributeError?
Best regards
--
Michał Sawicz <mi...@sa...>
|