I am running a script to update data and on some records I get the error:

*** InternalError: current transaction is aborted, commands ignored until
end of transaction block

Turning on pdb.set_trace() enabled me to find the actual problem line:


skr = db.akb_authors[i]

where i = 176530 in this case (many cases like this.

When in pdb-debug it repeats the problem when I run it on the commandline:

x  = db(db.akb_authors.id == i).select()
*** InternalError: current transaction is aborted, commands ignored until
end of transaction block

but when I interrup the script, and start a new web2py-shell and do the
following there is no problem:

python web2py.py -M -N -S akb
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.99.2 (2011-09-26 06:55:33) stable
Database drivers available: pysqlite2, pymysql, PostgreSQL, mongoDB
Python 2.6.7 (r267:88850, Jul 10 2011, 08:11:54)
Type "copyright", "credits" or "license" for more information.

IPython 0.10.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: i = 176530

In [2]: x  = db(db.akb_authors.id == i).select()

This is frustrating because I have to work with thousands of cases like
this.

My question:  what could cause this behaviour in the script that would not
be a problem outside the script?

Shortened code of the function where sids is a list of id's from
db.akb_authors:
    for i in sids:
    try:

            skr = db.akb_authors[i]

            # do some stuff with skr

             db.akb_authors[i] = dict(address = adr, gender = gender, race =
race, birthdate = gebore)
              #do some more stuff
     except:
            import pdb
            pdb.set_trace()


Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
                                                    2 Pet. 1:2b,3a

Reply via email to