Shelve bug in ActiveState Python? [or Python as Houdini]

2008-04-23 Thread Bob Kline
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



Issue Attempting to Import xml.parsers.xmlproc in ActivePython

2008-04-23 Thread Fraser MacKenzie
I am using python2.5 (downloaded and installed about a week ago).

I am attempting to validate an XML file, using the appropriate DTD.  In
looking at the ASPN Cookbook, it appears that I am suppossed to use the
following imports:

from xml.parsers.xmlproc import xmlproc
from xml.parsers.xmlproc import xmlval
from xml.parsers.xmlproc import xmldtd

However, when I attempt to run my python program, I get the following
errors:

Traceback (most recent call last):
  File ./feedManager.py, line 62, in module
from xml.parsers.xmlproc import xmlproc
ImportError: No module named xmlproc

I have tried just importing xml.parsers, and that has no issue.  Is there a
known issue with the latest release of ActivePython and xmlproc?

Thanks for any information or help that you can provide.

-- 
Fraser MacKenzie
[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



Re: Issue Attempting to Import xml.parsers.xmlproc in ActivePython

2008-04-23 Thread Bob Kline
Fraser MacKenzie wrote:
 I am using python2.5 (downloaded and installed about a week ago).

 I am attempting to validate an XML file, using the appropriate DTD.  
 In looking at the ASPN Cookbook, it appears that I am suppossed to use 
 the following imports:

 from xml.parsers.xmlproc import xmlproc
 from xml.parsers.xmlproc import xmlval
 from xml.parsers.xmlproc import xmldtd

 However, when I attempt to run my python program, I get the following 
 errors:

 Traceback (most recent call last):
   File ./feedManager.py, line 62, in module
 from xml.parsers.xmlproc import xmlproc
 ImportError: No module named xmlproc

 I have tried just importing xml.parsers, and that has no issue.  Is 
 there a known issue with the latest release of ActivePython and xmlproc?

You need to install PyXML [1].  You might want to look at more recent 
packages, such as lxml.etree [2], as it's not clear whether PyXML is 
still being maintained.

[1] http://www.python.org/community/sigs/current/xml-sig/
[2] http://codespeak.net/lxml/

-- 
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



Re: Shelve bug in ActiveState Python? [or Python as Houdini]

2008-04-23 Thread Trent Mick
Trent Mick wrote:
 Does seem supicious. I don't have much experience with shelve, but it 
 should just crash. Do you have another platform that you can try to 
 repro on? A repro code snippet would, of course, help a lot.

s/should/shouldn't/

Duh,
Trent

-- 
Trent Mick
trentm at activestate.com
___
ActivePython mailing list
ActivePython@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython



Re: Issue Attempting to Import xml.parsers.xmlproc in ActivePython

2008-04-23 Thread Fraser MacKenzie
I am unfortunately a python novice.  I know that I can use PPM to add in perl 
packages.  How can I add modules to ActivePython.

Fraser MacKenzie
[EMAIL PROTECTED]

-Original Message-
From: Bob Kline [EMAIL PROTECTED]

Date: Wed, 23 Apr 2008 17:11:44 
To:Fraser MacKenzie [EMAIL PROTECTED]
Cc:ActivePython Mailing List activepython@listserv.ActiveState.com
Subject: Re: Issue Attempting to Import xml.parsers.xmlproc in ActivePython


Fraser MacKenzie wrote:
 I am using python2.5 (downloaded and installed about a week ago).

 I am attempting to validate an XML file, using the appropriate DTD.  
 In looking at the ASPN Cookbook, it appears that I am suppossed to use 
 the following imports:

 from xml.parsers.xmlproc import xmlproc
 from xml.parsers.xmlproc import xmlval
 from xml.parsers.xmlproc import xmldtd

 However, when I attempt to run my python program, I get the following 
 errors:

 Traceback (most recent call last):
   File ./feedManager.py, line 62, in module
 from xml.parsers.xmlproc import xmlproc
 ImportError: No module named xmlproc

 I have tried just importing xml.parsers, and that has no issue.  Is 
 there a known issue with the latest release of ActivePython and xmlproc?

You need to install PyXML [1].  You might want to look at more recent 
packages, such as lxml.etree [2], as it's not clear whether PyXML is 
still being maintained.

[1] http://www.python.org/community/sigs/current/xml-sig/
[2] http://codespeak.net/lxml/

-- 
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



Re: Issue Attempting to Import xml.parsers.xmlproc in ActivePython

2008-04-23 Thread Bob Kline
Fraser MacKenzie wrote:
 I guess, a question along the same lines, is that I am trying to use the 
 libxml2 and libxlst modules, and they don't seem to be available for 
 ActivePython.  Where can I get them to install them (or is it even possible). 
  The reason I need them is to allow for an XML transformation using XSL.
   

I gently suggest that you hold off on asking any further questions until 
you've looked more carefully at the answers you've already gotten. :-)  
Again, take a look at the lxml module.

-- 
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