NameError when calling fetchone() etc.

Ashley Glassel <[email protected]>
Newsgroups gmane.comp.python.sybase
Message-ID <20030123072803.A12451@the-gate>
When I any application that includes calling fetchone() eg:

i get the following error

[root@the-box db-stuff]# python four.py
Traceback (most recent call last):
  File "four.py", line 25, in ?
    print getDatabases()
  File "four.py", line 10, in getDatabases
    for row in c.fetchall():
  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

and the four.py programme i am running:

#!/usr/bin/python

import Sybase

def getDatabases():
    db=Sybase.connect('server','user','pwd')
    c=db.cursor()
    c.execute('select * from DRUser')
    varDatabases={}
    for row in c.fetchall():
        varDatabases.setdefault(row[0],[]).append(row[1])
        varDatabases.setdefault(row[0],[]).append(row[2])
    c.close()
    db.close()
    outputHTML="Content-type: text/html\n\n"
    outputHTML+="""
<html>
    <body><center>
        <h5>test</h5>
    </center></body>
</html>"""
    return outputHTML

if __name__ == "__main__":
    print getDatabases()
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.