"AttributeError: ct_cursor" when trying to execute any statement

MichaƂ Sawicz <[email protected]> Wed, 02 Feb 2011 13:32:08 +0100
Newsgroups gmane.comp.python.sybase
Message-ID <[email protected]>
--===============2782640622958111882==
Content-Type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature";
	boundary="=-C6PIKqHulxA9VviJTaml"


--=-C6PIKqHulxA9VviJTaml
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi again, I worked around the linking problem by exporting

LD_PRELOAD=3D/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=3D/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.
>=20
> 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.
>=20
> In [1]: import logging
>=20
> In [2]: logging.basicConfig()
>=20
> In [3]: import Sybase
>=20
> In [4]: Sybase.DEBUG =3D True
>=20
> In [5]: db =3D Sybase.connect('ara', 'DBA', 'SQL')
> DEBUG:sybase:locking
> DEBUG:sybase:unlocking
>=20
> 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 las=
t)
>=20
> /home/msawicz/<ipython console> in <module>()
>=20
> /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 =3D self.cursor()
> -> 1229             cursor.execute(sql)
>    1230             cursor.close()
>    1231         finally:
>=20
> /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 !=3D self._sql:
> --> 694                 self.prepare(sql, select=3Dselect)
>     695             else:
>     696                 # Re-execute same request
>=20
> /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" % se=
lf)
> --> 499                 status =3D self._cmd.ct_cursor(CS_CURSOR_DECLARE,=
 "ctmp%x" % id(self), sql, CS_UNUSED)
>     500                 if status !=3D CS_SUCCEED:
>     501                     self._raise_error(Error('ct_cursor declare'))
>=20
> AttributeError: ct_cursor
>=20
> In [7]:=20

When exiting, an additional error:

> In [8]:=20
> 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
--=20
Micha=C5=82 Sawicz <[email protected]>

--=-C6PIKqHulxA9VviJTaml
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEABECAAYFAk1JTsgACgkQzQlUjpZYlbfbiACfefL9ZIWV5TUbHKG0FU44gWFc
SRMAoKENGpDX/zHUorY/p+R+x68d8Bvg
=KS0a
-----END PGP SIGNATURE-----

--=-C6PIKqHulxA9VviJTaml--



--===============2782640622958111882==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
--===============2782640622958111882==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Python-sybase-misc mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-sybase-misc

--===============2782640622958111882==--