ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activepython
activepython
Shelve bug in ActiveState Python? [or Python as Houdini]
by Bob Kline other posts by this author
Apr 23 2008 2:01PM messages near this date
view in the new Beta List Site
Re: Issue Attempting to Import xml.parsers.xmlproc in ActivePython | Re: Shelve bug in ActiveState Python? [or Python as Houdini]
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:bkline@[...].com

_______________________________________________
ActivePython mailing list
ActivePython@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
Thread:
Bob Kline
Trent Mick
Trent Mick

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved