I'm looking at behavior in ActiveState's Python which looks suspiciously 
like a bug.  I've got a number of steps before I'm ready to file a real 
bug report (I'm a minor release behind (2.5.1.1), for one thing, so I'll 
need to test with the latest release, and creating a repro case for this 
one won't be trivial), but I'd like to do a little reality check here on 
the listserv before I plow ahead.

Boiling the code down to its essentials, and with a few debugging output 
statements thrown in, what we have looks something like this:

import sys, shelve, ...

class ClinicalTrial: ....

class Batch:
    def __init__(self, ...):
        self.trials = []

batches = shelve.open("batches")
documentIds = assembleSomeDocumentIds(...)
for docId in documentIds:
    clinicalTrial = ClinicalTrial(docId)
    if clinicalTrial.email not in batches:
        batch = Batch(...)
    else:
        batch = batches[clinicalTrial.email]
    batch.append(clinicalTrial)
    sys.stderr.write("about to replace batch\n")
    try:
        batches[clinicalTrial.email] = batch
    except Exception, e:
        sys.stderr.write("bailing: %s\n" % e)
    sys.stderr.write("done replacing batch\n")
....

The script gets through fewer than a couple dozen iterations through the 
loop (if it ran to completion it would be several thousand iterations), 
then just stops.  No exception thrown, no indication whatsoever that an 
error has occurred, nothing.  The two expected stderr messages get 
written for each iteration through the loop until the last time, when it 
writes the "about to replace batch" message and then just disappears 
into thin air.  Never see the accompanying "done replacing ..." message, 
nor the "bailing ..." message.  This can't possibly be anything but a 
bug in the Python engine, can it?  I can't think of any other logical 
explanation.  Just to preempt one suggestion - I do make sure I don't 
have any garbage laying around in the shelve file between runs (though 
even if I didn't do that, it surely wouldn't be acceptable for Python to 
just slip through a hole in the floor).

-- 
Bob Kline
http://www.rksystems.com
mailto:[EMAIL PROTECTED]

_______________________________________________
ActivePython mailing list
ActivePython@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to