Excepción PySQLite2
SER.RI-TIC-Alexis Roda
alexis.roda en urv.net
Mar Abr 11 12:35:18 CEST 2006
Andrés Ignacio Martínez Soto wrote:
> Hola a la lista, estoy haciendo mi blog "artesanal" con Python, lo tengo
Ejecutalo paso a paso. Apostaria a que la excepcion se dispara por la
llamada a alguno de los metodos fetchxxxx() (solo tienen sentido al
hacer un select, no un insert o update) y es enmascarada por una segunda
excepcion disparada por el __del__() que tienes dentro del except.
for i in xrange(1000) :
print "Es mala idea capturar *TODAS* las excepciones!!"
Segun el PEP249 (http://www.python.org/dev/peps/pep-0249/):
.fetchall()
[...]
An Error (or subclass) exception is raised if the previous
call to executeXXX() did not produce any result set or no
call was issued yet.
una solucion seria utilitzar el atributo description para determinar se
puede llamarse a fetchxxxx()
.description
[...]
This attribute will be None for operations that
do not return rows or if the cursor has not had an
operation invoked via the executeXXX() method yet.
Saludos
--
////
(@ @)
----------------------------oOO----(_)----OOo--------------------------
<> Ojo por ojo y el mundo acabara ciego
/\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain)
-----------------------------------------------------------------------
Más información sobre la lista de distribución Python-es