(forw) [ashley_glassel@hotmail.com: Re: [python-sybase] NameError when calling fetchone() etc.]
Dave Cole
djc at object-craft.com.au
25 Jan 2003 00:09:49 +1100
> upgrade to sybase v.36pre3 and now I get these errors:
> [root@the-box hash]# python
> Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
> [GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import Sybase
> >>> db = Sybase.connect('Oscar', 'docent', 'docent')
> >>> c = db.cursor()
> >>> c.execute("select * from docent.DRUser")
> >>> c.fetchall()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.2/site-packages/Sybase.py", line 490, in fetchall
> row = self.fetchone()
> File "/usr/lib/python2.2/site-packages/Sybase.py", line 410, in fetchone
> _array = _fetch_rows(self._cmd, self._bufs)
> File "/usr/lib/python2.2/site-packages/Sybase.py", line 196, in _fetch_rows
> raise Error('ct_fetch')
> Sybase.Error: ct_fetch
> >>>
> Any idea what is going wrong here?
>
> It also doesn't matter if I use the c.fetchall() or c.fetchone()
Try doing this and post the debug output:
import Sybase
Sybase._ctx.debug = 1
db = Sybase.connect('Oscar', 'docent', 'docent')
c = db.cursor()
c.execute("select * from docent.DRUser")
c.fetchall()
- Dave
--
http://www.object-craft.com.au