[Zope3-dev] 'thread_local' AttributeError in zope.security.checker

Paul Carduner paulcarduner at gmail.com
Tue Aug 14 19:32:06 EDT 2007

Hello zope3-dev,

I came across an error I have not seen before.  Just for reference,
here is the last snippet from the traceback:

File "/home/pcardune/Work/ZContact/zcontact-lp/eggs/tmpgwuq6O/zope.security-3.4.0b4-py2.4-linux-i686.egg/zope/security/checker.py",
line 420, in ?
AttributeError: 'module' object has no attribute 'thread_local'

The interesting part to me is that it was so easy to fix.  Here is a
snippet of the relevant area of failing code from

# Get optimized versions
    import zope.security._zope_security_checker
except ImportError:
    from zope.security._zope_security_checker import _checkers, selectChecker
    from zope.security._zope_security_checker import NoProxy, Checker
    from zope.security._zope_security_checker import _defaultChecker
    from zope.security._zope_security_checker import _available_by_default
    zope.interface.classImplements(Checker, INameBasedChecker)

The very first import statement is throwing the error, but alas, it is
not an ImportError.  If I patch this code by catching the
AttributeError in the same way the ImportError is caught, then
everything works fine.  I tried looking into the c code, but after
years of python development, the c code just frightens me (a bit).
That said, I would really appreciate any pointers people might be able
to give me on what thread_local is for and why I (don't) need it.

I also just noticed that ~5 hours ago, Jim made a change to this file,
so I tried using the latest trunk revision but got the same error.


More information about the Zope3-dev mailing list