[python-sybase] still problem with pending results

Dave Cole djc at object-craft.com.au
29 May 2002 23:39:08 +1000


> Hello, some time ago in april I've once sent a mail to this
> group. However I still do not get things to run properly. I have
> tried to following code with python2.2 on Linux, Sybase 11.9.2, with
> python-sybase adapter V0.34 and V0.35pre2. Both fail with slightly
> different messages. What I actually want to do is just to close the
> cursor c1, open a new cursor c2 and then run the correct SQL
> there. But this also fails which is why I tried to do what Harri
> Pasanen suggested - unfortunately without success. Any ideas?

One thing which would really help would be to insert the following
line after import Sybase:

Sybase._ctx.debug = 1

This will turn on quite a lot of debugging which should help me
pinpoint what is going wrong.

> ---------------------------------------------------------
> import Sybase
> 
> db = Sybase.connect('monkey', 'cenix_admin', 'blabli1', 'cenix_lab')
> c1 = db.cursor()
> try:
>     # produce an error - THE TABLE 'DUMMY' DOES NOT EXIST
>     c1.execute('select * from dummy')
> except:
>     print 'select failed'
> 
> c1.close()
> db.commit()
> 
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 603,
> in commit
>      self.execute('commit transaction')
>    File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 633,
> in execute
>      self._raise_error(Error, 'ct_send')
>    File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 525,
> in _raise_error
>      raise exc(text)
> Sybase.Error: ct_send
> Layer: 1, Origin: 1
> ct_cmd_drop(): user api layer: external error: This routine can be
> called only if the command
> structure is idle.
> Layer: 1, Origin: 1
> ct_send(): user api layer: external error: This routine cannot be
> called because another command structure has results pending.

- Dave

-- 
http://www.object-craft.com.au