[Zope-dev] A suggestion for changing exception handler when loading 'c' optimisations to make modules more friendly for GAE

Chris Withers chris at simplistix.co.uk
Fri Jul 3 05:09:19 EDT 2009


Tobias Rodäbel wrote:
> Sorry, I don't agree. We assume an imp.load_dynamic function from what  
> we read in the python documentation. But the implementation in GAE  
> does not provide the expected api. So the NotImplementedError seems  
> absolutely correct to me (see http://www.python.org/doc/2.5.2/lib/module-exceptions.html#l2h-114) 

Ahhh, I see, sorry, misread where the exception was coming from.

Surely the try:except for the NotImplementedError should be rwapped just 
around the call to imp.load_dynamic, then?

ie:

try:
   imp.load_dynamic(__name__,__file__)
except NotImplementedError:
   raise ImportError('load_dynamic not available so C extension cannot 
be used')

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope-Dev mailing list