(forw) [[email protected]: Re: NameError when calling fetchone() etc.]

Ashley Glassel <[email protected]>
Newsgroups gmane.comp.python.sybase
Message-ID <20030124151318.A25569@the-gate>
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()

thanks

Ashley


* Dave Cole ([email protected]) wrote:
> 
> > more information. I am using freetds v0.60 and python-sybase v0.35 
> > 
> > [root@the-box db-stuff]# 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('Server', 'user','passwd')
> > >>> c = db.cursor()
> > >>> c.execute("select * from docent.DRUser where userID = '50970'")
> > >>> c.fetchall()
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> >   File "/usr/lib/python2.2/site-packages/Sybase.py", line 489, in fetchall
> >     row = self.fetchone()
> >   File "/usr/lib/python2.2/site-packages/Sybase.py", line 409, in fetchone
> >     _array = _fetch_rows(self._cmd, self._bufs)
> >   File "/usr/lib/python2.2/site-packages/Sybase.py", line 193, in _fetch_rows
> >     elif status in (CS_ROW_FAIL, CS_FAIL, CS_CANCELED,
> > NameError: global name 'CS_PENDING' is not defined
> > >>>
> 
> FreeTDS does not define the CS_PENDING and CS_BUSY values.  The quick
> fix for this problem is to delete all references to CS_PENDING and
> CS_BUSY from Sybase.py.
> 
> 0.36pre2 does not use CS_PENDING or CS_BUSY in Sybase.py
> 
> - Dave
> 
> -- 
> http://www.object-craft.com.au
> 
> _______________________________________________
> Python-sybase mailing list
> [email protected]
> https://object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase

----- End forwarded message -----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.